Checking incident opened date vs closed date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2017 02:03 PM
hi All.
I am quite new on service now
I am trying to write a script that checks if an incident closed is after the opened date.
I manage to get the closed date with g_form.getValue('closed_at'). but g_form.getValue('opened_at') return an empty value.
Help...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2017 02:07 PM
Gilles,
Make sure you have the opened_at field on the form. If it isn't on the form then g_form cannot see it. Which could explain why it isnt' working as your expect. You may also have to them the values returned into a javascript date time like this:
var timestamp = new Date(g_form.getValue('closed_at'))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2017 02:07 PM
Hi Gilles,
are you having that challenge now? I do not see how this is possible since the opened_at date and time are set by the system when the record is created. The close_at time is set by the system again once the INC state is changed to closed. Does your enterpriser resolve Incidents and then the OOB BR closed them for you within 3-7 days?