Process Builder: Auto Create and Activate the Contract



Contract management is the management of Contracts made with customers, vendors or partners. Salesforce also allow you to manage the contracts. This article helps you to understand, how to auto create and activate a contract using Process Builder and how to create a Process that will  only fire “Whenever a record is created, and any time it’s edited to subsequently meet criteria“. Let’s start with a business use case
Business Use case: – Universal Container is using Salesforce to manage the Contracts. Salesforce allow you to create a Contract for an Account . Whenever an Opportunity is successfully closed (Stage :- Closed Won) auto create a new Contract and activate it. Also set the Contract Start Date = Close date of current Opportunity and Contract Term (months) =12
Solution of above business requirement
There are multiple ways to solve the above business requirement. You can either use Apex trigger, Combination of Flow & Process Builder and few more. To solve this requirement, we will use Process Builder.  Before starting the Implementation,  you have to understand one important concept related to contract management. Salesforce doesn’t allow you to insert a Contract with Status = Activated (Either through Data Loader, WFR or Process Builder), if you attempt to do so you will get an error. In other words we can say, it is not possible to insert and activate Contracts in a single step. Contracts must first be inserted with a Status of Draft and then after inserting, they can then be updated with a status of Activated. Follow the below instructions to create a Process for the above business requirement
1. Create a check-box field Contract – Opportunity (Default value :- Unchecked) on Contract object, so that Process Builder will fire and activate only those contracts which gets created after the successful closure of an Opportunity, as shown in the following screenshot

2. To create a Process click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder. Click on the New Button available on Process management page, A popup will open where you have to enter a Name (Enter Auto create and activate the Contract as name)API Name and Description as shown in the below screenshot

3. Once you are done click on the Save button, it will redirect you to Process canvas. Click on Object node to add object, Select Opportunity object, in this case and set the evaluation criteria, Please refer to the following screenshot for more details

4. The next step is to define Process criteria. For this click on Add Criteria node, enter Criteria NameSet filter conditions (Similar to Rule Criteria in WFR),
  • For Criteria action select Filter conditions are met
  • Enter criteria [Opportunity].StageNameClosed Won and [Opportunity].AccountId Is Null False
  • For Filter conditions select Do you want to execute the actions only when specified changes are made to the record? Check-box, Please refer to the following screenshot for more detail

The reason behind to select the check-box Do you want to execute the actions only when specified changes are made to the record?  is allow the Process Builder to execute the actions only if the record meets the criteria now, but the values that the record had immediately before it was saved didn’t meet criteria. This means that these actions won’t be executed when irrelevant changes are made.
5. Once you are done click on the Save button, it will redirect you to Process canvas. Now we have to add an immediate action into the Process to create a Contract record. For this use Create a Record action, Please refer to the following screenshot for more details
6. Once you are done click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot, don’t forget to active the Process by clicking on the Activate button

Once you are done with process activation, click on View all Processes button, it will redirect you to Process management page.
7. The next step is to create a new Process on Contract object to activate the contract, which gets created after the successful closure of an Opportunity (By Process 1) . Click on the New Button available on Process management page, A popup will open where you have to enter a Name (Enter Auto create and activate the Contract as name),API Name and Description as shown in the below screenshot

8. Once you are done click on the Save button, it will redirect you to Process canvas. Click on Object node to add object, Select Contract object, in this case and set the evaluation criteria, Please refer to the following screenshot for more details

9. The next step is to define Process criteria. For this click on Add Criteria node, enter Criteria NameSet filter conditions (Similar to Rule Criteria in WFR),
  • For Criteria action select Filter conditions are met
  • Enter criteria [Contract].Contract_Opportunity__cTrue
  • For Filter conditions select All of the conditions are met (AND), Please refer to the following screenshot for more details

10. Once you are done click on the Save button, it will redirect you to Process canvas. The next step is to update the Status of the  newly created Contract. For this use we will use Immediate action,  Update Records, . Please refer the following screenshot for more details

11. Once you are done click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot, don’t forget to active the Process by clicking on the Activate button.

It’s time to test this Process
Now onwards if a business user updates the Opportunity Status to Closed Won, Process builder will automatically Create a new Contract and active it.
1. Currently Opportunity “Edge Emergency Generator” in Qualification Stage, as shown in the following screenshot

2. Now we will try to update the Opportunity “Edge Emergency Generator” Stage to Closed Won, as shown in the following screenshot

3. Once you are done, click on the Save button and check the Contract created by Process Builder, as shown in the following screenshot

Note :-I will suggest you to Implement this first on your developer org test it and then move it to Production.

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget