You are here:
RenewContractBatchJobProcessInterface
RenewContractBatchJobProcessInterface processes the list of contracts that are ready for renewal.
Type
Loosely typed
Triggered When
The batch job RenewContractBatchJob triggers the RenewContractBatchJobProcessInterface.
Signature
Access |
Signature |
|---|---|
global |
|
Default Implementation
The DefaultContractRenewalProcessDefaultContractRenewalProcess implementation creates opportunity, order,
or quote and its line items based on the AutoRenewObjectCreation__c
value. If no value is specified, the implementation updates the contract
SendRenewalNotification__c value.
Other Implementations
None
Input Parameters
contractList
Required
Type: List<Contract>
The list of contracts that can be processed for renewal
Output Parameters
None
Sample Implementation
global with sharing class DefaultContractRenewalProcess implements VlocityOpenInterface
{
global Boolean invokeMethod(string methodName, Map<string, object> inputMap, Map<string, object> outMap, Map<string, object> options)
{
Boolean success = true;
try
{
if(methodName == 'processContractRenewal')
{
processContractRenewal(inputMap, outMap, options);
}
}
catch(Exception ex)
{
success = false;
throw ex;
}
return success;
}
private void processContractRenewal(Map<string, object> inputMap, Map<string, object> outMap, Map<string, object> options)
{
List<Contract> contractList = (List<Contract>)inputMap.get('contractList');
Logger.dbg('Contract List with array size: ' + contractList);
List<Contract> opptyContractList = new List<Contract>();
List<Contract> quoteContractList = new List<Contract>();
List<Contract> orderContractList = new List<Contract>();
List<Contract> notificationContractList = new List<Contract>();
for(Contract contract: contractList)
{
if(contract.AutoRenewObjectCreation__c == 'Opportunity')
{
opptyContractList.add(contract);
}
else if(contract.AutoRenewObjectCreation__c == 'Quote')
{
quoteContractList.add(contract);
}
else if(contract.AutoRenewObjectCreation__c == 'Order')
{
orderContractList.add(contract);
}
else
{
notificationContractList.add(contract);
}
}
Logger.dbg('Oppty Contract List: ' + opptyContractList);
ObjectsClonerService.cloneObjectsAndLineItems('Opportunity', opptyContractList);
Logger.dbg('Quote Contract List: ' + quoteContractList);
ObjectsClonerService.cloneObjectsAndLineItems('Quote', quoteContractList);
Logger.dbg('Order Contract List: ' + orderContractList);
ObjectsClonerService.cloneObjectsAndLineItems('Order', orderContractList);
if(notificationContractList.size() > 0)
{
Logger.dbg('Notification Contract List: ' + notificationContractList);
processNotificationContracts(notificationContractList);
}
}
private void processNotificationContracts(List<Contract> notificationContractList)
{
Logger.dbg('Inside processNotificationContracts');
for(Contract contract: notificationContractList)
{
contract.SendRenewalNotification__c = true;
}
Update notificationContractList;
}
}
