Help Center

Defaulting an Approver Based on Another Field

 

If you want to default an Approver based on the value in another field, using Process Builder is the best way to handle this. In this example, we want to default an Approver in an ECO's Lifecycle based on another field on the Change object, but these steps can work on similar use cases involving Approver default values.

This task will consist of a few relatively simple steps:

A. Create a New Process using Process Builder

B. Add Object to the Process

C. Add Criteria for the Process

D. Add the Action

E. Activate the Process

 

FYI - Process Builder:

Process Builder is a Salesforce automation tool. For users who are familiar with Workflow Rules, the Process Builder is the next generation. Similarly to workflow rules, Process Builders allows automatic action to take place when a user creates or edits a record based on defined criteria. Traditional workflow can still be utilized in parallel, however, Process Builder gives you the ability to do things that workflow can’t. 

With Process Builder, you can:

  • Create a record of any object type
  • Update any related record—not just the record or its parent
  • Use a quick action to create a record, update a record, or log a call
  • Invoke a process from another process
  • Launch a flow—you can’t schedule this action with workflow
  • Send an email
  • Post to Chatter
  • Submit a record for approval

A. Create a New Process using Process Builder

1. Click Setup in top right corner.

1_setup.png

2. In the Setup Search Field, type Process Builder. Then click on Process Builder below the Create > Workflows & Approvals menu.

2_SEARCH_PROCESS_BUILDER.png

3. Click New in top right. If you have no previous processes created, your screen will look like the below.

3_new_process_builder.png

 4. In the new window, enter your Process Name. Click or tab over into the API Name field and it will populate. Use the Description field to describe in longer form what exactly your process will do.

The Process Starts When picklist is asking what exactly will trigger this process to run. Populate this value based on your use case.

Click Save.

4_new_process_builder_form.png

In this example, I want to default the "Responsible Engineer" value on the change object as an Approver on the same Change object, but only in the "In Approval" Phase. So my trigger would be when the "Responsible Engineer" field is populated - i.e. When a Record Changes.

5_new_process_builder_form_filled_out.png

 

B. Add Object to the Process

1. Next, we need to tell the Builder which object to run the Process on. 

Click Add Object. 

In this example, we're working the Change object.

6_add_object.png

2. We want this process to run whenever a record is created or edited, so we will select this.

3. We will check "Yes" for Recursion in this example. But be careful when using this option! You can pretty easily create unnecessary reevaluations of records.

For help decided if Recursion should be chosen in your use case, see this article:

https://help.salesforce.com/articleView?id=process_advanced_reevaluate.htm&type=5

4. Click Save.

 

C. Add Criteria for the Process

1. Now we need to add Criteria to our process -- we need to tell the system how to choose the records it will update.

Click Add Criteria.

7_define_criteria.png

2. Over on the right, we will let the system know which records should be updated. 

In this example, I only want to populate Change items which have Lifecycle Statuses which occur before the Approved stage. So I have filled in the Criteria Name as such. 

Select Criteria for Executing Actions. In this example, we have a list of criterion which the record must meet in order to be updated, so we will select Conditions are Met. 

entering_criteria.png

3. Now, we will identify those criterion. On line 1, click into the Field field. 

For our example, we want to identify the records with phases we do not want to update.

So I will select the Field called Phase Name.

And click Choose.

8_criteria_number_1_phase_name.png

4. Then I will specify the records that we're updating, the Phase Names Do Not Equal the String (text) value "Approved."

entering_criteria_zoon.png

5. Because we have two other Phase Names Criteria, we will repeat steps 3 and 4 twice more. Once for the "Does Not Equal Implemented" and another for "Does Not Equal Canceled."

6. In our example, Criteria Line 4 will specify that we only want to affect records who's "Responsible Engineer" field is currently blank. 

Click into the Line 4 Field field. Select Responsible Engineer, as below and click Choose.

10_set_criteria_number_4.png

7. Because we want this field to be blank, we will select the operator Is Null.

Select Boolean as the field type and False as the value.

8. Our example requires that all of our listed conditions be met, so we will select All of the Conditions Are Met (AND).

entering_criteria.png

9. Click Save.

11_save_criteria_.png

D. Add the Action

1. Now that we've established which records should be updated and when, we need to tell the system what to do! We will specify what exactly what the update should be.

Below "Immediate Actions," click Add Action. 

12_set_immediate_actions_step_1_define_apex.png

2. Over on the right, we'll fill in the Action definition.

In order to default an approver, we need to use a specific Apex Class.

Select Apex as your Action Type.

Name your Action - for our example, we've named it Add Responsible Engineer as Approver because I want the process to default the value from the Responsible Engineer field as an Approver.

Be sure to select the Set Workflow Approvers on Criteria as your Apex Class.

Click Save.

selecting_action_type.png

 

3. Now we're going to specify exactly what to update. This Apex Class requires three important variables: Record ID, Phase Name, and User or Group Name.

13_fill_out_immediate_actions.png

4. For Line 1 Record ID, select Field Reference as the Field Type. 

Click into the Value field and the below pop-up will appear.

Select the Record ID on the Change object.

Click Choose.

15_record_id_save_immediate_action_part_1.png

5. For Line 2 Phase Name, select String as the field type.

Click into the Value field and the below pop-up will appear.

Select the Phase Name.

Click Choose.

16_immediate_action_part_2_phase_name.png

6.  For Line 3 User or Group Name, select Field Reference as the field type.

Click into the Value field and the below pop-up will appear.

Select the Username.

Click Choose.

17_responsible_engineer_username_immed_action_part_3.png

7. Click Save.

18_immediate_actions_done_save.png

 

E. Activate the Process

1. Click Activate at top right.

19_activate.png

2. We get a notification that our Process will override any older versions. 

Click Confirm.

19_Activate_Process_Builder.png

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.