Applying process enforcement for SCRA
Prerequisites
The following is a prerequisite to applying a process enforcement for a contact or account:
- A process enforcement is created, and is active. Refer to section Creating a Process Enforcement.
Steps
Perform the following steps to apply the process enforcement for a contact or account:
- Log in to your Salesforce account.
- Go to Contacts or Accounts, and search for and click on the required contact or account.
In the Contact or Account details page, click Apply Process Enforcement to apply the PE. If this button is not visible on the page, refer to section Process Enforcement for steps to add it to the page layout.
Select the Process Enforcement from the drop down list. This is the list of PEs you created using the Servicing Configuration tab. For example, SCRA,
Specify the Start Date from which this PE is applicable and its Expiry Date (optional).
- Click Validate to check whether this PE can be applied on the selected contact or account or not.
Once validation is successful, click Apply. All the actions corresponding to the PE are applied on all the contracts of the contact or account.
Note:If validation fails for even one contract, the process enforcement is not applied for any of the contracts.
Applying process enforcement from a future date
If the PE start date is provided as a future date, the PE is created in an inactive state. The validation for it is done when the PE start date arrives, and it is applied from the specified date.
To enable process enforcements on future dates, you must schedule the ProcessEnforcementJob job. This job runs daily and checks all the non-expired, inactive PEs whose start date is the same as the current system date. All such identified PEs are applied for the given day.
Steps
Perform the following steps to schedule the ProcessEnforcementJob 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 ProcessEnforcementApplyJob implements Schedulable { public ProcessEnforcementApplyJob() { //Constructor } public void execute(SchedulableContext sc) { clcommon.ProcessEnforcementJob peJob = new clcommon.ProcessEnforcementJob('SCRA' , 'Apply'); Database.executeBatch(peJob); } }
Specify the ProcessEnforcementJob parameters. In the above sample code block, replace the Process Enforcement Name "SCRA" with the name of the PE that you have created and want to apply, and action as Apply.
- Schedule this class to execute daily using the Schedule Apex option in Apex classes. When the batch job runs, notifications may be received using mails. If validation of a future dated PE fails, and it is not applied, you can check the results in the Process Enforcement Action Results object.
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.