Discover How to Auto Populate Delegated Approver Field on a New User Record!

Discover How to Auto Populate Delegated Approver Field on a New User Record!

Last Updated on April 4, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

How do you Auto-Populate Delegated Approver Field on a New User Record?

Objectives:

After reading this blog post, the reader will be able to:

  •  Create a Record-triggered flow to auto-populate the delegated approver field for new users.

Business Use case

Warren Mason is working as a System Administrator at Gurukul on Cloud (GoC) received the following requirement – On a New User’s record, auto-populate the User’s Manager as a delegated approver.

Automation Champion Approach (I-do):

The delegated approver is an alternate approver. If populated, this user receives the same approval requests as the original approver. Delegated approvers don’t have the ability to reassign approval requests – they can only approve or reject approval requests. 

Assigning a delegated approver comes in handy when a User is out of office. In such circumstances, a delegated approver, designated by the User, can approve requests on behalf of the User. However, if the Users forget to configure delegated approvers/administrators then, this would delay approval of requests, if and when, they are out of the office. A User can select a delegated administrator/approver by navigating to his/her personal settings.

In this article, we will discuss how to automate the process of auto-populating a new User’s Manager as a delegated approver. There are multiple solutions possible for the above business scenario.

To solve this requirement, we will use the After-save Record-Triggered Flow. Check out this article to understand why we are using after-save record-triggered flow for this scenario.

Before proceeding ahead, you have to understand the User object. It represents a user in your organization.

Field Name Details
DelegatedApproverId Id of the user who is a delegated approver for this user.

Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it.


Let’s begin building this automation process.

Guided Practice (We-do):

There are 3 steps to solve Warren’s business requirement using Record-Triggered Flow. We must:

  1. Define flow properties for record-triggered flow
  2. Add a Decision element to check if the manager is populated or not 
  3. Add an assignment element to populate delegated approver 

Step 1: Define Flow Properties

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
    1. Object: User
    2. Trigger the Flow When: A record is created or updated
    3. Set Entry Criteria
      1. Condition Requirements: None
    4. Optimize the Flow For Fast Fields Update
  5. Click Done.

Step 2: Using Decision Element to Check if the Manager is Populated or Not

Now we will use the Decision element to check the manager from the field is populated or not and user record is just created. 

  1. On Flow Designer, click on the + icon and select the Decision element. 
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Under Outcome Details, enter the Label the API Name will auto-populate.
  4. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!$Record.Id}
      2. Operator: Is Null
      3. Value: {!$GlobalConstant.True}
    2. Click Add Condition 
    3. Row 2:
      1. Resource: {!$Record.ManagerId}
      2. Operator: Is Null
      3. Value: {!$GlobalConstant.False}

Step 3: Using Assignment Element to Update Delegated Approver

The next step is to update the delegated approver on the user. We will use the Assignment element, as we are using before-save flow. 

  1. On Flow Designer, below the Yes node, click on the +icon and select the Assignment element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Set Variable Value
    1. Row 1:
      1. Field: {!$Record.DelegatedApproverId}
      2. Operator: Equals
      3. Value: {!$Record.ManagerId}
  4. Click Done.

In the end, Warren’s Flow will look like the following screenshot:

Once everything looks good, perform the steps below: 

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. API Version for Running the Flow: 50
  5. Interview Label: Auto Assign Delegated Approver {!$Flow.CurrentDateTime}
  6. Click Save

Almost there! Once everything looks good, click the Activate button.

Proof of Concept

Now onwards if a user is created, the Delegated Approver will be automatically populated. 

  1. Navigate to Setup | Administration | Users | Users
  2. Create a New User and mark it as Active, make sure to populate Manager.
  3. Click Save.
  4. Now navigate to the Delegated Approver field in the user detail page and check whose name is populated – yes you are right it’s James Smith!!!

Formative Assessment:

I want to hear from you!

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

2 thoughts on “Discover How to Auto Populate Delegated Approver Field on a New User Record!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.