Using Flow to Make Fields Required in Approval Process

In Salesforce, an approval process is a workflow automation feature that defines a sequence of steps for record approval. It allows users to submit records for approval and defines criteria for approval or rejection based on certain conditions. During the process, designated approvers can review, approve, or reject the submitted records, streamlining the decision-making process in an organization. While it is possible to configure approval process actions, there is one crucial feature that is currently missing. It is not possible to make fields required in approval process. This can sound like a simple issue that you can solve using validation rules. However, custom validation rules do not trigger based on approval process actions. Therefore, it is not possible to use validation rules in order to make fields required on approval process.

An error should be present to halt the approval process. This can be achieved by building a before-save record-triggered flow that displays a custom error message.

Before Building the Flow

Mark "Re-evaluate Workflow Rules after Field Change" on your field update action. This makes sure that your approval process triggers other automations (in this case, flow).

Re-evaluate Workflow Rules after Field Change

Build a Flow to Make Fields Required in Approval Process

1- Create a new (before save) record triggered flow that runs when the approval status becomes "Approved". This is just an example, you can use any field that you want. Just make sure that it is the field that the approval process updates.

2- Add a Decision element to check if the required field is null or not. For instance, let's make the Product Interest field required.

Decision Element to Check the Field

3- If the field is null, we want to display an error message. Therefore, add a Custom Error element in order to display an error message.

At the end, your flow should look like this.

End of the Flow

If you try to approve the record and the Product Interest field is null, you will get an error message like this.

Error Message

Build a Flow to Make Approval Comments Required in Approval Process

Let's apply the same logic in order to make the approval comments required in approval process.

1- Create a new (before save) record triggered flow that runs when the approval status becomes "Rejected". Again, this is just an example, you can use any field that you want. Just make sure that it is the field that the approval process updates.

Start Criteria of the Flow

2- Add a Get Records element to get the last Process Instance record related to your opportunity. Process Instance means the approval process.

Get the Last Process Instance

3- We are building this flow to make the approval comments required for rejecting the approval request. Therefore, add a Get Records element to get the last Process Instance Step record that is related to the Process Instance that you found in the previous step. Make sure to put a criteria to get the Rejected step and sort by the CreatedDate.

Get Process Instance Step

4- Add a Decision element to check if there is a comment on the Process Instance Step that you found.

Decision to Check Comments

5- If the Comments field is blank, we want to display an error message. Therefore, add an Custom Error element in order to display an error message.

Display Custom Error

At the end, your flow should look like this.

End of the Flow to Make Fields Required in Approval Process

If you attempt to reject the record without providing comments, you will receive an error message like this.

Approval Comments are Required

10 Comments

  1. Another amazing workaround... This is quite crooked to be honest, I would rather approve the record using a screen flow, making the required fields logic there and submitting the approval process through an Action

    • That's also an option but you have to hide the standard actions and use the screen flow (with Apex actions) for approving/rejecting.

  2. I've been trying to find a solution for required fields before submitting for approval and error messaging forever. This was so helpful! thank you!

  3. Hi, thank you! I tried to follow your solution but im keep getting the error message, regardless of the comments. Do you have any idea why?

  4. Hi Yumi, even if we are giving the rejection comments, it is giving the same error message. Same issue as the other user posted

1 Trackback / Pingback

  1. 20 Most Popular Salesforce Admin & Developer Blogs 2023 | Salesforce Ben

Leave a Reply

Your email address will not be published.


*