# 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

#####  

##### UPDATE: As of Summer 21, all of this can be done natively, and will perform better since it doesn't require any extra queries.

To check ISNEW(), simply check if the $Record\_\_prior variable is null.

##### Archive:

<span style="text-decoration: line-through;">Record Edit flows are pretty cool, and will hopefully replace PB altogether.</span>

<span style="text-decoration: line-through;">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.</span>

<span style="text-decoration: line-through;">Until they are added in for real, here are some tricks to build it yourself.</span>

<span style="text-decoration: line-through;">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.</span>

##### <span style="text-decoration: line-through;">ISNEW()</span>

<span style="text-decoration: line-through;">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. </span>

##### <span style="text-decoration: line-through;">ISCHANGED()</span>

<span style="text-decoration: line-through;">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.</span>

##### <span style="text-decoration: line-through;">PRIORVALUE()</span>

<span style="text-decoration: line-through;">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.</span>

##### <span style="text-decoration: line-through;">DISCLAIMER:</span>

<span style="text-decoration: line-through;">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.</span>