You are here:
Setting a Contract For Auto Renewal
You can save time by setting a contract for auto renewal using a scheduled apex job. The RenewContractBatchJobScheduler job can be initiated towards the end of a contract's current term to automatically extend the term. An email notification is sent to the customer based on the renewal notification setting.
For the RenewContractBatchJobScheduler apex job to run successfully, you need to ensure that the required contract fields have values set, and that two custom settings are configured.
- Set a Contract for Auto Renewal.
Ensure that the following contract values are filled:
-
Contract Start Date
-
Contract Term
-
Renewal Notification Object
Based on this dropdown selection, an Opportunity, Quote, or Order is created after the RenewContractBatchJobScheduler scheduled job is completed.
-
Renewal Notification Period
The number of days or months in advance the customer is notified of their new contract's effective date.
-
Renewal Notification Term
The renewal notification is set in days or months.
The default query is 'Select Id,AutoRenewObjectCreation_c,SendRenewalNotificationc from Contract where IsAutoRenewc = false AND RenewalStartDate_c < ' today' AND RenewalStartDate__c > '+lastRunDate;ImportantDon't select the Auto Renew check box.
-
Price Book
The contract must have an associated Price Book Entry Id with the opportunity/quote/order.
-
- Configure Custom Settings for Auto Renewal.
Configure RenewContractBatchJobProcess and RenewContractBatchJobQuery custom settings to make the auto renewal generation work.
- From Setup, enter Custom Settings in the Quick Find box, then click Custom Settings.
- Next to Custom Class Implementation, click Manage, then click New.
- Enter the following values:
-
Name: RenewContractBatchJobProcess
-
Class Name: DefaultContractRenewalProcess
-
- Click Save & New.
- Enter the following values:
-
Name: RenewContractBatchJobQuery
-
Class Name: DefaultContractRenewalQuery
-
- Click Save.
- Set Up a Scheduled Apex Job for Auto Renewal.
Create a job that references the RenewContractBatchJobScheduler apex class and runs on a schedule that aligns with your renewal dates.
NoteThe RenewContractBatchJobScheduler apex job can only be scheduled once every hour.
- From Setup, enter Apex Classes in the Quick Find box, then click Schedule Apex.
- Enter the following values:
-
Job Name: Adescriptivejobname
-
Apex Class: RenewContractBatchJobScheduler
-
Schedule Apex Execution: Enter a job schedule based on your renewal date requirement.
-
- Click Save. The job gets queued in the Apex Jobs list. When the scheduled Apex job executes, the renewal for the selected contract is created. After the job is completed, the customer receives an email confirming the completion of auto renewal of their contract and a corresponding opportunity, quote, or order is created.

