You are here:
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.
Signature
Loosely typed
public Boolean invokeMethod(String methodName, Map < String, Object > input, Map < String, Object > output, Map < String, Object > options)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.
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);
}
}

