Use Case: Mass Update Records From Related List #1

Have you heard of inline editing? This is my favorite feature that I use EVERYDAY! Though amazing as it is, there are still limitations. For example, you can only edit records with the same record type, and it is only available in the list view but not in the related list. So today, we will introduce a mysterious “ids” variable to mass update records in related lists! It will not be as flexible as inline editing, but better than nothing I would say. (Or let’s all upvote this idea :D)

Why mysterious you wonder? This ids variable is similar to recordId. If your flow has this variable, Salesforce will also auto-populate it, but with multiple ids! What?! However, there are some important notes:

The Magical “ids” Variables
  1. This variable is not documented officially, so you can only know when you are in an exclusive club. (Joking. I did a lot of searching.)
  2. Because of reason 1, there is a risk that it can break. (My first testing didn’t work at all)
  3. It only works with related lists/list views that have checkboxes in the front.
  4. The setup of the variable has to be EXACTLY like below.

Let’s dive in on how to set this up!

* Big thanks to Jaime from Viajes BIDtravel for sending in the case, and to Peter from Findock for sharing his thoughts!

Lulu Mobile uses the standard Account and Case object to keep track of their customers’ cases. Sometimes there can be many cases under one account, and they want to be able to mass edit the cases right from the related list to boost productivity.

Even though we can get multiple ids at once, they still exist as a collection variable. To edit each record, we will have to use loop to unpack the collection. That means we have to choose between two outcomes:

  1. Mass update the same fields with the same value for each record
  2. Update the record one record at a time on the screen

We will introduce outcom#1 in this article and have a separate article about outcome#2. Lastly, we will launch the solution as a List View button, and it works on both related list and list view.

Comparison for the two flows:

See the pros and cons of two flows and choose the one that suits you the best.

Flow#1 (This Article)Flow#2
Pros+ Less elements in Loop so better performance
+ Can skip the Done Screen and use retURL
+ Can see the current value of each field
+ Can modify each record separately
Cons– Cannot redirect back to original Account page– Longer process time and more screens
Comparison for different solutions when there is only one record:

This solution can work even if you only want to edit one record. Then it will be similar to the solution in this article – Add Clone Button To Related List. Here is the comparison of two different methods:

List View Button (This Article)Formula
Pros+ Good looking UI
+ Can handle multiple records
+ Easier to reach
+ Can have other field values fed to input variables
Cons– Always has to use Loop even for one record only– Can be confusing as it is a field on object

Screen FlowAssignmentVariable/Collection
LoopUpdate RecordsInput Variable
Screen Element

Does the solution solve your problem? If not, write us what your problem is and we will build the flow for you!

Official Salesforce Help Article On Flow

Subscribe
Notify of
guest

24 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Nia

Hello, Melody! Does using the “ids” variable mean that you have to give users the “Manage Flows” permission to enable them to run the flow? Or are they able to run it with just the “Run Flow” permission? I created a flow similar to yours, except instead of mass updating records, they are being mass submitted for approval. The only way a user can run the flow is if they have “Manage Flows” on their profile. “Run Flow” is not enough, and I am wondering if that’s due to the “ids” variable. What is your experience? Thank you in advance!

Alexis Kasperavicius

Nice trick! Note I’ve found even better results by using URLFOR within the button code. It returns the user back to the Account on flow completion instead of a generic case listing and works well in classic or lightning.

Using your example, the button code would be:

{!URLFOR('/flow/Related_List_Mass_Edit',null,[retURL=Account.Id])}
Eyji

This is awesome, thanks !

Jan

Would it be possible somehow that all related records are chosen by default?
So in other words, i just want to push the button and don’t need to check the records on the related list

Jan

thanks, i will look into the datatable component

Suzy Rokke

Hi! Love your tutorials! Curious if you could help me understand how this could be rewritten for changing the owner on Contacts? I’m getting stuck in step 8 – there is seemingly no CurrentContact > Owner field for me to save the Add Updated Case to collection part too.

Joe

Hi Melody,

Thanks for this, its a great solution and worked perfectly for a use case I required.

I wondered if there are any considerations you are aware of if I wanted to use this flow to also mass-update a lookup field on the records? I’ve built the flow as above and it works for updating a checkbox, however I tried also adding a lookup screen component and getting a weird issue where an error message displays. If I hit the Next button it duplicates the lookup component and the error message each time. Any advice would be greatly appreciated! Thanks in advance

Joe

Thanks Melody, I appreciate that – good news, it was just me being dim! Simple issue with the custom button I built. I can confirm the flow now works perfectly for my use case so thank you very much!

eiyu

Hi, nice use case. I have created a flow myself where i used the ids variable and have a button on a list view. Working as above approach

Uses goes to list view, selects a number of cases and clicks on the button.

The flow will then loop through the ids and using a record singel variable set some fields (status = spam, type = junk, etc) then add that to a record collection variable and update and voila. All cases are updated!

But then i experienced a problem which i would like to solve.

Problem:
The list view shows all cases the user has access to (read) but not all of the cases the user has edit permission. So when the user chooses some cases where he/she doesn’t have edit access and click on the button he/she will receive: INSUFFICIENT_ACCESS_OR_READONLY: insufficient access rights on object id

Which i understand why of course, but how to handle this?

I also had a button on the page layout just for one case with the same functionality (only then you don’t use ids but you use recordId. In this case i used the UserRecordAccess object (see screenshot) and works like a charm (using a screenflow i could then add a screen and warn the user he/she doesn’t have edit access)

https://developer.salesforce.com/docs/atlas.en-
us.api.meta/api/sforce_api_objects_userrecordaccess.htm

Now my question is how can i use this UserRecordAccess object for the list view button with the ids variable?

Any idea?

Screenshot_1.png
eiyu

Yes i was afraid so and not best practise, then again if its’s the only solution at this time i think it should do. A list view usually shows only 50 records at once so perhaps it can be done.

Also what can be done is just easy count the ids and if above 100 then show a message ” too many records selected ” or something similar.

As last comment, can you explain the number 100 ?

Last edited 2 years ago by eiyu
eiyu

Mhm sorry i tried but i think i don’t understand it in the end.
I have a loop where collection variable is {!ids} (list view records)
I then should do a get record for “UserRecordAccess object”

But how to configure this ?

GET RECORDS: Get Record Access list view
Find all UserRecordAccess records where:
RecordId Equals {!Loop_Cases} (5007Y00000HV7p7QAD)
AND HasEditAccess Equals true
AND UserId Equals {!$User.Id} (0051v000004KpCn)
Store the values of these fields in Get_Record_Access_list_view: Id
Result
Failed to find records.

And recordId must be specified in that get “UserRecordAccess object” otherwise it will also throw an error

Edit: related to this perhaps? : https://trailblazer.salesforce.com/issues_view?id=a1p3A0000018Bl6QAE&title=in-flow-can-t-perform-lookup-recordlookup-fastlookup-on-userrecordaccess-object&fbclid=IwAR3-jLHFHCNjr-c7xpJGIhYSIK-ztC65tRACKv6zfWNAElBjBUEC3W4WmfM

Or is it me?

Last edited 2 years ago by eiyu
Piyush Arora

Initially, I faced the Assertion Failed: Descriptor Flow Lightning Runtime error. I have enabled the flow to run in lightning runtime only. Not sure, if others faced the same issue.
I switched to classic and triggered the button from there and it worked. Switched back to lightning and it started working. Similar issue and solution mentioned in the below link:

https://trailhead.salesforce.com/pt-BR/trailblazer-community/feed/0D54S00000A7xILSAZ

MKS

Hey, I’m having trouble following these instructions. I think I have it set up correctly – collection variable titled ids available for input, loop, and update, launched from custom list button with url content source and sidebar-less behavior… but the ids don’t seem to be entering the flow when I activate it and test it on some real related list records.

I even added some display text to the first screen to display {!ids} so that I could see if any of them were being inputted, but {!ids} keeps turning up blank on the screen, and nothing actually happens when the flow finishes running.

Any advice on what I’m doing wrong?

MKS

Update (several weeks later) I still don’t know what was wrong, but I made an identical new flow from scratch and it worked just fine. I’m bamboozled, but at least it works now!

Groot

I see one issue with the following approach:

If the user leaves a field blank on the input screen, it will overwrite the existing value for the selected records with NULL.
Ex : Number of Days was set to 4,5,6,9 for the 4 records selected and on the Input screen the user didn’t populate the Number of Days field. So, once the process ends, the values 4,5,6,9 will be replaced with NULL, which may not be the desired output.

allison oneill

good afternoon, I have a question — using a similar concept as outlined in your post but instead of mass updating records, do you know how to select one or multiple records from a related list and create new records on a different object?