Storing previous value of a field and using it in a UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 07:08 AM
Is there any other way to store the previous value of a field and then leverage that in a UI action apart from achieving it with creation of a field and using a Business Rule to store it and then using it in a UI Action ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 07:17 AM
If your table is audited, you can glide the audit history table (sys_history_set) and get the previous value of the field.
Transactional tables like incident are audited OOB in servicenow but tables like sys_user are not.
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 07:19 AM
One can query the sys_history_line table. But I guess Servicenow doesn't recommend it as it could cause performance issues
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 08:04 AM - edited ‎10-05-2023 08:06 AM
Your query should be optimised to 1 record and a particular field. Yes there could be performance issues but this is a exceptional requirement as you dont want to use a extra field or a BR which can fetch previous value.
There could be multiple other ways like creating a database view of sys_history_line table and your particular table say incident which will reduce your query time, but again its worth checking.
Raghav
MVP 2023