
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-15-2021 06:36 AM
Have you ever had the need to retrieve the previous value in the same manner that you do when using the previous object in a Business rule?
There is actually a way to accomplish this.
Since ServiceNow stores most changes in the sys_audit table you can go there to get all previous values if needed.
A fair warning though, the sys_audit table is huge, so don't go down this path if not absolutely necessary.
Now to the solution;
Create a Subflow that takes input parameters on which table, field name, record sysid, and created by.
The subflow itself will be simple, it does a look up on the audit table, using supplied input parameters to get the result, and returns the "oldvalue" value.
Then call on that subflow from whatever Flow that uses the trigger "Record updated"
Example images below.
- 3,960 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This is a bad idea. Having logic like this running will cause global platform performance degradation.
Instead, design an Event to grab previous value of the field you care about when the trigger conditions occur.
Then allow the previous value to be passed into the Flow. Same result, waay less compute.