How to roll your own "ISCHANGED", "PRIORVALUE", and "ISNEW" in before-save flows

How to roll your own "ISNEW", "ISCHANGED", and "PRIORVALUE", and in before-save record-edit flows

Record Edit flows are pretty cool, and will hopefully replace PB altogether.

There are a few features still missing, and included in those are ways to check if a record is new, if a field was changed, and what the previous value is.

Until they are added in for real, here are some tricks to build it yourself.

For a little background - these flows will automatically contain a variable called $Record, which refers to the record that was created/modified thereby calling the flow. You can access any of the record's fields via $Record.FieldName.

ISNEW()

To tell if the record is new (ie: was just created and not yet saved), you simply need to check in your flow if the ID field is null. You'd do this either in a formula or in a decision by checking $Record.Id. 

ISCHANGED()

To check if a specific field was changed, you'll want to do a Get Records. Fetch the record whose Id matches $Record.Id and store it in a record variable. Then you can use a decision to check if any field in your record variable is the same as the same field in the $Record variable. For example, check if $Record.Name = AccountRecord.Name. If they match, it means the field has not been changed.

PRIORVALUE()

The method for PRIORVALUE() is very similar to that of ISCHANGED(). You'll just want to check what value is in the field from your Get Records variable.

DISCLAIMER:

These tricks only seems to work in "before-save" flows, since a record that wasn't ever  "saved" doesn't have an Id, and if it's an existing record, the database still stores old values. If someone figures out tricks for these please ping @solo-admin.