You are here:
QuoteContractFlagRollupInterface
Determine when to flag a Quote as contract-required. If there is no implementation for this interface, the Quote is not flagged.
Type
Loosely typed
Triggered When
The QuoteContractFlagRollupInterface is triggered when a Quote line item is inserted or deleted and when a Product Track As Agreement flag is updated. If an implementation is not available, then no action occurs.
Called In
The QuoteLineItem trigger and the Product2 trigger call the QuoteContractFlagRollupInterface.
Signature
Access |
Signature |
|---|---|
global |
|
Default Implementation
Using the DefaultQuoteLineItemRollupContractFlag
implementation, if at least one Quote Product line item is set to Track as
Agreement=true, set the Quote as contract required.
The DefaultQuoteLineItemRollupContractFlag is not documented because it is a public class.
Other Implementations
None
Input Parameters
methodName
Required
Type: String
The name of the method to execute, for example, rollupContractFlag
IdsToUpdate
Type: List<Id>
The Quote line item IDs to update, for example:
List<Id> quoteToUpdateIds = (List<Id>) inputMap.get('IdsToUpdate');
Output Parameters
None
Sample Implementation
global with sharing class CustomQuoteLineItemRollupContractFlag implements vlocity_cmt.VlocityOpenInterface
{
public Boolean invokeMethod(string methodName, Map<string, object> inputMap, Map<string, object> outMap, Map<string, object> options)
{
Boolean success = true;
if(methodName == 'rollupContractFlag')
{
rollupContractFlag(inputMap, outMap, options);
}
return success;
}
private static void rollupContractFlag(Map<string, object> inputMap, Map<string, object> outMap, Map<string, object> options)
{
List<Id> quoteToUpdateIds = (List<Id>)inputMap.get('IdsToUpdate');
if(quoteToUpdateIds != null && quoteToUpdateIds.size() > 0)
{
Map<Id, Quote> quoteMap = new Map<Id, Quote>([SELECT
Id,
vlocity_cmt__IsContractRequired__c
FROM
Quote
WHERE
Id in: quoteToUpdateIds]);
List<QuoteLineItem> quoteLineItemList = [SELECT
Id,
QuoteId,
vlocity_cmt__IsProductTrackAgreement__c
FROM
QuoteLineItem
WHERE
QuoteId in: quoteToUpdateIds
ORDER BY
QuoteId];
List<Quote> quoteToUpdate = new List<Quote>();
if(quoteMap != null && quoteLineItemList != null && quoteMap.size() > 0)
{
//update quote to have flag to false
for(Id quoteId: quoteMap.keySet())
{
Quote quoteObj = quoteMap.get(quoteId);
quoteObj.IsContractRequired__c = false;
quoteToUpdate.add(quoteObj);
}
if(quoteLineItemList.size() > 0)
{
for(QuoteLineItem item: quoteLineItemList)
{
if(item.IsProductTrackAgreement__c == true)
{
Quote quoteObj2 = quoteMap.get(item.QuoteId);
quoteObj2.vlocity_cmt__IsContractRequired__c = true;
}
}
}
}
Update quoteToUpdate;
}
}
}

