Blog

Transfer Record Owners via Screen Flows

Use case:

Salesforce users can easily transfer the record owners via screen flows.

Transfer Record Owners via Screen Flows

Step 1:

Query the necessary profiles and store the profiles id’s into the flows variable. In our use case we have to query the “System Administrator” and “Standard User” profiles.

Transfer Record Owners via Screen Flows

Transfer Record Owners via Screen Flows

Transfer Record Owners via Screen Flows

Step 2:

Prepare the initial screen for selecting the users and object details.

Regarding the user’s “From” and “To” selections, we can select the record choice picklist component.

While setup the record choice set for user selection, get the user records which are “Active” users, profiles under “System Administrator” and “Standard User”.

Transfer Record Owners via Screen Flows

Transfer Record Owners via Screen Flows

Transfer Record Owners via Screen Flows

Step 3:

If the users “From” and “To” both are the same, we can just through the alert messages as below.

Transfer Record Owners via Screen Flows

Transfer Record Owners via Screen Flows

Step 4:

As per our use case, we can transfer one user to another user on the “Account” and “Opportunity” objects.

If the user can try to update the account records owner from one user to another, get all the account records which is all the record owner same as the user “From” selection.

Transfer Record Owners via Screen Flows

If the user can try to update the opportunities records owner from one user to another user, get all the opportunities records which is all the record owner same as the user “From” selection and only the open opportunities.

Transfer Record Owners via Screen Flows

Step 5:

Iterate each record and assign the “To” user selection into the current iterated owner and add the count of those records to display the total number of records are available to transfer.

Transfer Record Owners via Screen Flows

Transfer Record Owners via Screen Flows

Transfer Record Owners via Screen Flows

Step 6:

Error handling is the most important one. We can handle the error in the following way.

Create a screen with the standard error message feature for debugging the error.

Transfer Record Owners via Screen Flows

Transfer Record Owners via Screen Flows

Step 7:

Finally, we can update the owners and give the confirmations to the users.

Transfer Record Owners via Screen Flows

Conclusion:

With the help of ScreenFlow, we can easily transfer the record owners without any manual works.