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
          RenewContractBatchJobQueryInterface

          RenewContractBatchJobQueryInterface

          Returns the query that gets a list of contracts that are ready for renewal.

          Type

          Loosely typed

          Triggered When

          The first part of the RenewContractBatchJob triggers the RenewContractBatchJobQueryInterface.

          Signature

          Access

          Signature

          global

          Boolean invokeMethod(String methodName, Map<String,Object> inputMap, Map<String,Object> outMap, Map<String,Object> options)

          Default Implementation

          The DefaultContractRenewalQueryDefaultContractRenewalQuery implementation is IsAutoRenew__c = false AND RenewalStartDate__c < today.

          Other Implementations

          None

          Input Parameters

          None

          Output Parameters

          query

          Required

          The query that the batch job will execute, for example:

          'Select Id,AutoRenewObjectCreation__c,SendRenewalNotification__c from Contract 
          where IsAutoRenew__c = false AND RenewalStartDate__c < '+today+
          ' AND RenewalStartDate__c > '+lastRunDate

          Sample Implementation

          global with sharing class DefaultContractRenewalQuery 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 == 'getQueryString')
                   {
                      getQueryString(inputMap, outMap, options);
                   }
                }
                catch(Exception ex)
                {
                   success = false;
                   throw ex;
                }
                return success;
             }
             private void getQueryString(Map<string, object> inputMap, Map<string, object> outMap, Map<string, object> options)
             {
                string lastRunDate = '2000-01-01';
                //Get today's date
                Date todaysDate = Date.today();
                Integer year = todaysDate.year();
                Integer month = todaysDate.month();
                Integer day = todaysDate.day();
                string dayString = string.valueOf(day);
                string monthString = string.valueOf(month);
                if(day < 10)
                {
                   dayString = '0' + day;
                }
                if(month < 10)
                {
                   monthString = '0' + month;
                }
                string today = year + '-' + monthString + '-' + dayString;
                //Get last batch job run date
                List<CpqConfigurationSetup__c> cpqSetUpList = [SELECT
                   Id,
                   Name,
                   SetupValue__c
                FROM
                   CpqConfigurationSetup__c
                WHERE
                   Name = 'ContractRenewalBatchJob'];
                if(cpqSetUpList.size() != 0)
                {
                   lastRunDate = cpqSetUpList.get(0).SetupValue__c;
                }
                string query = 'Select Id,AutoRenewObjectCreation__c,SendRenewalNotification__c from Contract where IsAutoRenew__c = false AND RenewalStartDate__c < ' + today + ' AND RenewalStartDate__c > ' + lastRunDate;
                outMap.put('query', query);
             }
          }
           
          Loading
          Salesforce Help | Article