- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 04:03 AM
Hi, I'm creating a Flow to retrieve records from the Hardware table, filtered by Status. I can loop the records and what I want to do is, for each record, get the date when the Status was changed. This is under Activities in the ServiceNow UI but that field isn't available in the Data Pill picker, is it possible to get this information? Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 04:18 AM
Hi,
Possible, yes.
Complex, yes.
A solution would be to perform a query on the sys_audit table, which is very large, so it should be avoided if possible.
Instead, you could create a new datetime field on the hardware table that is updated every time the status changes (through a business rule), then it would be much easier to extract the needed data.
What is it you want to achieve?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 04:18 AM
Hi,
Possible, yes.
Complex, yes.
A solution would be to perform a query on the sys_audit table, which is very large, so it should be avoided if possible.
Instead, you could create a new datetime field on the hardware table that is updated every time the status changes (through a business rule), then it would be much easier to extract the needed data.
What is it you want to achieve?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 04:19 AM
This is a tricky thing. A hardware record may be updated multiple times after the Status was changed. ServiceNow does stores the date when the Status was updated, but that is stored in the Hardware table itself. You will find that information only in the History / Audit tables. This is the reason you are unable to find that in the Data pill picker
Now, it is almost never a good reason to query the history/ audit table as they are very large tables and querying then may cause performance impacts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 04:25 AM
Thanks both for replying so quickly. This will run outside of working hours so performance isn't such an issue, however, as that table grows in size it could easily become impractical
Creating a field that is updated via a business rule (only when the state is set to certain values) seems the better approach.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 04:29 AM
You are right. That is the only good way to do this.
Just one suggestion though, use a flow designer rather than a BR.