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

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.

 
109
Kudos
 
109
Kudos

Now read this

Controlling chatter publisher layout on home page and profile

I recently had a global action that I wanted to display on the home page, but not on object detail pages. It looked like I would have to add this action to the global publisher layout, and then override the publisher layouts on all... Continue →