Most of the time, we want to show some information about whether the user has edit access on record or not. This will help them to avoid clicking the edit/save button after changing some record information. This post will explain how to show user record access using flow.
Record access can be given to the user using a profile, sharing rules, permission sets, or using any other record-sharing mechanism.
Let us see how to show whether the user has access to the record or not. We can use UserRecordAccess object to get record access information. We can get information like the user has edit access, read access, delete access, or edit access using this object.
In this post, we will show, whether the user has edit access or not on the current Case record. We will use screen flow to show user information.
Steps To Show User Record Access Using Flow
- Create a record Id variable
- Get record access using Get Element
- Show access information using the Screen Element
- Test Flow
1. Create a record Id variable
We need recordId to get user access to a record. So we need recordId as input to flow. Create a string type variable with API name- recordId.
2. Get record access using Get Element
Now let us get record access information using the UserRecordAccess object. We need a Record Id and User Id to get user access information. We will use the Get Record element to retrieve access information.
We will save retrieved access information in the variables. I have used hasEditAccess to store edit access information and recordId to store RecordId. It is mandatory to select RecordId field. Based on your requirement you can retrieve HasDeleteAccess, HasReadAccess, or HasAllAccess fields and display information.
3. Show access information using the Screen Element
Now we have record access information in local variables., We will add a Screen element and Display Text Control to show edit access information using those local variables.
Similarly, we can create another screen element for showing Read Only text information. Which will show “Record is Readonly”.
The complete Flow will look like below
4. Test Flow
The flow will show user access detail on the record page.