I'm building a Flow to update sequential values on records.
- Each record (CampaignMember within a Campaign of specific record type) has a numerical "rank" value that can be set manually by a user.
- When a value is changed on one record the Flow updates all the records that need to be changed in order to keep the rankings sequential and prevent duplicates.
So for example, if I set a record's rank to 7 and there are already records with ranks 7, 8, and 9, the existing records should all be incremented by one.
The Flow works, however, since each record is updated the Flow gets triggered again by each subsequent record that is updated. I could modify the Flow to only touch one record at a time but that would be really inefficient.
Currently I load up the other CampaignMember records that need to be updated, loop through them incrementing, or decrementing, their rank and put them into a variable collection that is saved at the end.
What would be nice is if I could only run the Flow when I can detect that the record was not updated by a Flow. Is there a way I can do this so that I can make the updates in bulk?
$Api.Session_Id
in a field calledRerank_Session_Id__c
and when you recurse, if the record's stamp matches$Api.Session_Id
, you know you don't need to do any further action in that Flow Interview