Incident management - Obtaining the date and time when additional comments were registered
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2023 05:01 AM
This is about incident management.
After setting the assignment destination, I would like to obtain the date and time when the first additional comment was registered.
ServiceNow support gave me the following advice:
A script is required for the contents of the business rules. However, I have no experience with JavaScript. Can you give me some advice on the content of the script?
--Advice from support--
I think the concept should flow as follows.
1. Create a new date time field called "Temporary response date and time" in the incident
2. Create a business rule for the table as additional comments will be saved in sys_journal_field
The contents of the business rule are as follows:
1. Executed at insert time
2. In the case of an incident and a comment, check if there is another comment with the same Element ID in sys_journal_field, and if there is not, set a "temporary response date and time" for the incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 10:57 PM
@Anand Kumar P
Thank you for your prompt reply.
Sorry, this issue has not been resolved yet.
Based on my previous reply, do you know the cause?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2023 05:17 AM
Hi @Shibayama,
var grIncident = new GlideRecord("sys_journal_field");
grIncident.addEncodedQuery("element_id="+current.sys_id);
grIncident.orderBy('sys_created_on')
grIncident.query();
if (grIncident.next()){
var created_on = grIncident.getDisplayValue('sys_created_on');
gs.info('created_on = '+ created_on);
//You can utilize this created_on variable to fulfil your requirement
};
Best Regards,
Tarun