ISCHANGED and PRIORVALUE in Before Save Flows (not for after save flows)

UPDATE - DEC 2020 : Spring21 should offer this natively, per poking in my pre-release org. Will link to release notes when they are available.

Before save flows do not directly offer functions like ISCHANGED, ISNEW, and PRIORVALUE

ISNEW can be handled by checking if $record.id is null (h/t to Jen Lee)

To handle ISCHANGED or PRIORVALUE, use a get records element to get the current record, which gives you the values from before your auto-launched-before-save-flow updates it.

To do this, select your object, and filter for id = $record.id
make sure to only store the first record, you dont need a collection here!

getRecord.png

Now you can check if it was changed in a decision element by comparing the new value ($record.yourField) with the prior value (getRecord.yourField)

in my case i wanted to check if it was equal to a certain value, and changed, so i went with a decision like this

decIsChangedSpecificValue.png

to just test if a field is changed, create a boolean formula like this

IF(TEXT({!getPriorValue.Status__c})!=TEXT({!$Record.Status__c}),TRUE,FALSE)

and evaluate if its TRUE in a decision element

IsChangedDec.png

was glad to figure this out today so i didnt need to setup a dozen or so field updates - just a simple assignment element or two (to keep it clean)!

the flow
magic.png

a gif of the magic in action. this before save flow blanks out all the bank info fields when status = Graduated. Go GDPR! In my case its not all that critical to avoid firing again if status remains graduated, but i did not want that behavior, so here we go…

magicinaction2.gif

UPDATE : MAY 16 2020 : AFTER SAVE FLOWS TOO?!?

the same approach appeared to work in after save flows. but i was actually using a before save flow…so…yeah. late night tests dont always work out as planned.

 
182
Kudos
 
182
Kudos

Now read this

scheduled flows + visualforce email templates

Many options exist to notify folks about salesforce data. I classify them as ‘popcorn’ (email alerts / chatter posts / notifications via workflows/flows/processes) or ‘consolidated’ (report subscriptions, that random opportunity email... Continue →