Jennifer Lee and Matt Henry in a new "How I Solved It."

How I Solved It: Edit a Locked Record Using Custom Permissions and Flow


Welcome to another post in the “How I Solved It” series. In this series, we do a deep dive into a specific business problem and share how one #AwesomeAdmin chose to solve it. Once you learn how they solved their specific problem, you’ll be inspired to try their solution yourself! Watch how Matt Henry was able to allow a user to change the value of a field on a record that was locked after an approval process, without unlocking the record. Read more details in the post below.

Key business problem

Our client has an annual Summer Youth Employment Program. Due to government funding, young people and their families need to have their eligibility determined in order to participate in the program. The electronic file in Salesforce goes through a review and audit process, resulting in an approved record that’s locked at the end of the approval process. However, back office staff need to make an additional edit after the record has been locked, to note that a paper file has been printed in order to meet a related funding requirement.

An approval process record lock prevents non-System Administrator users from editing specific records after final approval. I needed to allow the staff to make a record edit to this one field, when needed, without unlocking the record or allowing edits to any other fields on the record.

How I solved it

1. Create a screen flow in system mode

First, I created a simple screen flow that surfaces the one field that requires the edit to the locked record.

Screen flow that allows staff to update the Paper File Status field.

The key here was to set the flow in system mode so that it can edit the Paper File Status field even though it’s been locked by an approval process. “System Context” allows the flow to edit the record with permissions like a System Administrator; this is the setting that will override the record lock set by the approval process. “Without Sharing” allows the flow to edit any record, without considering whether the user using the flow can see the record. When building flows, use these settings with care, not as defaults. But in this case, the ability to select System Context is the reason for using Flow in this solution.

Screen flow advanced settings showing the flow is set to run in System Context Without Sharing—Access All Data.

2. Create a custom permission

Next, I created a custom permission so I can control the users who can use the screen flow. A custom permission simply has a name. Give it a short name that describes its function. In my case, I called my custom permission Manage Paper File Status. Also, complete the Description field with the intended purpose of this permission, as a gift to other admins (or your future self). The custom permission does not (by itself) do anything. It can be referenced by Salesforce to check whether a user has the custom permission. Tools that can do this include validation rules, flows, Apex code, and even (as we’ll see later) page component conditional visibility settings!

Manage Paper File Status custom permission.

3. Assign the custom permission to a permission set

In order for a custom permission to be assigned to users, it needs to be added to a profile or permission set. Like with the custom permission and most other items in Setup, give it a short name that describes its function and complete the Description field. In my example, I gave the same name to the permission set and the custom permission: Manage Paper File Status. My intent, in this case, was to only add this one permission to the permission set.

Manage Paper File Status custom permission added to the Manage Paper File Status permission set.

4. Deploy the screen flow on the Lightning record page

I added the screen flow to the Lightning record page using the Flow component. Then, I set component visibility so that it will only appear if (1) the record met the criteria for the flow to be used and (2) the user has the custom permission.

In my scenario, I set the Screen Flow component to only show when the Eligibility File Status equals Passed Audit, the Paper File Status equals Ready for Paper File Creation, and the user has the Manage Paper File Status custom permission.

Configured Screen Flow component using component visibility.

Below is an image of the deployed screen flow, visible on a record where it’s appropriate to use. For staff, it’s very easy—just one click!

Lighting record page with the Screen Flow component exposed.

5. Give your users a list view

The staff working on these records are working with a high volume in a short timeframe. Over the course of 6 weeks, they’ll process a couple thousand records. In order to make it easy to identify the records they should print paper files for, I provided a list view set with the same filters as the Flow component visibility.

Configured list view using the same Flow component visibility conditions.

Business results

Now, when an office staff person needs to print paper files from approved records, they can access a list view that shows them only the records they should work with. When they finish printing each record, they can update the record in Salesforce with one click. The record falls off their work list (the list view). When the list view is empty, they know they’re all caught up and can move on to their next task supporting the Summer Youth Employment Program (or take a well-deserved coffee break!).

Do try this at home

This example was real and it’s very simple. But the principle behind it could be applied in all sorts of ways. Let your imagination run wild!

Let us know what you thought of this solution, and tell us how you want to use it with #AwesomeAdmins #HowISolvedIt.


Want to see more good stuff? Subscribe to our channel!


Have an Idea for a Story?

We are all about the community and sharing ideas.
Do you have an interesting idea or useful tip that you want to share?