Loading
Get Started with Communications, Media, and Energy & Utilities (CME)...
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          ResolveRefDate Interface

          ResolveRefDate Interface

          Fetches the reference date at runtime with respect to a specified order, opportunity, quote, or line item. The reference date determines the correct version of products to be referenced from the cart.

          Namespace

          vlocity_cmt

          Signature

          Loosely typed

          public Boolean invokeMethod(String methodName, Map < String, Object > input, Map < String, Object > output, Map < String, Object > options)

          Default Implementation

          DefaultResolveRefDateImplementation Class

          Other Implementations

          None

          Usage

          When Versioning is enabled, every order, opportunity, quote and line item is assigned a reference date. This reference date determines the correct version of products to be referenced from the cart.

          For example, when a certain order is loaded, the selectables for that order must have the correct version as per the reference date of the order. Similarly, when a bundled product is added to a cart, all child items of that product must have the correct reference date with respect to the reference date of the root item.

          The DefaultResolveReferenceDateImplementation class returns the reference date for a given order ID, opportunity ID, quote ID, or line item ID. It can also process multiple Order IDs, Opportunity IDs, or Quote IDs by passing the set of IDs in the input parameters.

          It is trigged in versioned orgs when any of the cart APIs fetches products at run time.

          By default, it uses the references dates as explained in Versioning Reference Dates. You can create a custom implementation to determine the reference date.

          Note
          Note The ResolveRefDate Interface is used regardless of whether the EPC Versioning feature is enabled in an org. In both versioning and non-versioning orgs, the reference date is used to validate the effectiveness of products in line items while generating the hierarchy.

          Methods

          Method

          Description

          Returns the reference date for the specified cart ID or line item ID.

          Example Implementation

          This sample implementation shows how the tetReferenceDate method is used to get the reference date for a specified object.

          global class SampleResolveRefDateImpl implements vlocity_cmt.VlocityOpenInterface{
              public Boolean invokeMethod(String methodName,
                                      Map<String, Object> input,
                                      Map<String, Object> output,
                                      Map<String, Object> options)
              {
                  if(methodName == 'getReferenceDate')
                  {
                      getReferenceDate(input,output,options);
                      return true;
                  }
                  if(methodName == 'getBulkReferenceDates')
                  {
                      getBulkReferenceDates(input,output,options);
                      return true;
                  }
                  return false;
              }
           
              private void getReferenceDate(Map<String, Object> input,
                                      Map<String, Object> output,
                                      Map<String, Object> options)
              {
                  Id parentItemId  = Id.valueOf(String.valueOf(input.get('parentItemId')));
                  Id parentXliId  = Id.valueOf(String.valueOf(input.get('parentXliId')));
                  SobjectType parentSobjectType = (SobjectType)input.get('parentSObjectType');
                   
                  //write your own logic to fetch reference date
                  output.put('referenceDate', referenceDate);
              }
          
              private void getBulkReferenceDates(Map<String, Object> input,
                                      Map<String, Object> output,
                                      Map<String, Object> options)
              {
                  Set<Id> parentItemIds = (Set<Id>)input.get('parentItemIds');
                  SobjectType parentSobjectType = (SobjectType)input.get('parentSObjectType');
                  
                  //write your own logic to fetch reference date
                  output.put('referenceDate', referenceDate);
              }
          }
          
           
          Loading
          Salesforce Help | Article