- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2021 12:31 AM
Hi Team
I have one of the incident status as "On Hold" in ServiceNow. I have an API script in Python which fetches all the incident from ServiceNow. How do I get the timestamp of when incident state is changed to "On Hold" like we have resolved_at.
Basically, I need a variable that holds On Hold timestamp for my script logic. Which table holds this value? to which table do I have to pass the incident sys_id and get that On Hold timestamp?
Please let me know ASAP if anyone knows how to get this done.
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2021 02:06 AM
You can use before update BR on incident table to set that custom date/time field
BR: Before Update
Condition:
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.u_field = new GlideDateTime(); // set the now time in this
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2021 12:50 AM
Hi
There is no OOB field I believe which store on hold time apart from SLA Definition. SLA Definition too if you are pausing SLA in On hold state then you will get the time in Pause time. If it dosent help then there is no way other than creating custom field and then storing datetime when incident move to On hold state.
Then you can use if in API
Hope this helps
Thank you
Prasad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2021 01:28 AM
Thanks for your reply. I will check whether it is available in SLA definition.
But can you also elaborate on creating a custom field and storing datetime when incident state changes to On hold. How it can be done?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2021 02:31 AM
Hi
Yes you can create Simple Date Time field and store current date time in it using BR.
Basically when your incident will move to on hold state your BR should get trigger and store current timestamp in your custom field.
See the BR mentioned by Ankur. It should work to autopopulate current date time
Thank you
Prasad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2021 01:05 AM
Hi,
As mentioned incident table doesn't have any OOB field for holding that.
But you can use API on this sys_history_line table which holds data when state changed to On Hold
But using that Table will have performance impact
Query as this -> set.tableSTARTSWITHincident^set=b52c5b6e076c74102011ff208c1ed075
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader