Expiring a SCRA process enforcement on the scheduled expiry date
You can expire a process enforcement on its scheduled expiry date, by scheduling the daily batch job, ProcessEnforcementExpiryJob job.Once you expire the PE, the impacted fields of the contracts of the contact or account are reverted to their original values, and payment schedules are regenerated.
Prerequisites
None.
Steps
Perform the following steps to schedule the ProcessEnforcementExpiryJob job:
- Log in to your Salesforce account.
- Go to Setup, Build, Develop, Apex Classes. The Apex Classes page is displayed.
- Click New.
Include the following code:
public class ProcessEnforcementExpiryJob implements Schedulable { public ProcessEnforcementExpiryJob() { //Constructor } public void execute(SchedulableContext sc) { clcommon.ProcessEnforcementJob peJob = new clcommon.ProcessEnforcementJob('SCRA' , 'Expiry'); Database.executeBatch(peJob); } }
Specify the ProcessEnforcementExpiryJob parameters. In the above sample code block, replace the Process Enforcement Name "SCRA" with the name of the PE that you want to expire, and action as Expiry.
- Click Validate to validate the code.
Click Save.
- Click Back to List to navigate to the list of Apex classes.
- Click Schedule Apex.
- Search for and select the ProcessEnforcementApplyJob job.
- Schedule it to run daily, and click Save. If the job fails to run for any reason, and the PE is not expired, you can check the results in the Process Enforcement Action Results object.
The Expired checkbox in the Process Enforcement Detail page gets selected when the PE is expired on the scheduled date.