- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 11:42 AM
Hello everyone, I wanted to know if you have any idea of how to approach this condition in flow designer, I think there's some scripting needed but I'm not sure. the conditional is the following one:
and this is all I have until now:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 02:35 PM - edited 02-26-2024 02:37 PM
The only direct access you have to the previous value is from within a Business Rule, not a flow. The flow is something that runs asynchronously, after a record has already been updated, so the previous value is no longer available to the program/flow logic. So you are best off accomplishing this logic in a Business Rule.
That said, if you absolutely need to do this from a flow after the update is already made, you may be able to pass the values to an Event that could then trigger a Flow.
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 02:35 PM - edited 02-26-2024 02:37 PM
The only direct access you have to the previous value is from within a Business Rule, not a flow. The flow is something that runs asynchronously, after a record has already been updated, so the previous value is no longer available to the program/flow logic. So you are best off accomplishing this logic in a Business Rule.
That said, if you absolutely need to do this from a flow after the update is already made, you may be able to pass the values to an Event that could then trigger a Flow.
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 04:22 AM
Thank you Paul!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 02:40 PM
Hi @mariavic1998 ,
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".
Please refer to below threads:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0855770
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 04:51 PM
That "fair warning" is not strong enough. Querying the sys_audit table is an extremely bad idea. Even if you have a very specific query, it can take hours or even days for a single query to complete, depending on the size of your table. Rather than unnecessarily looking up the value from the flow, I would strongly recommend considering the approach of using a business rule, which provides you both the current and previous values, and if you need to pass this to a Flow, then simply fire an Event with both the current and previous values as parameters of the Event, and then to handle the Event run a script to start a Flow using the parameters.
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.