Write a script to calculate the time taken from new to in progress state of incident and display
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2023 02:15 AM
Write a script to calculate the time taken from new to in progress state of incident and display on form field.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2023 04:30 AM
you try this business rule
(function executeRule(current, previous /*null when async*/ ) {
// Check if the incident has transitioned from 'New' to 'In Progress'
var createdTime = current.sys_created_on;
//gs.log("query:" + createdTime);
var updatedTime = current.sys_updated_on;
//gs.log("query:" + updatedTime);
var timeDifference = gs.dateDiff(createdTime, updatedTime);
//gs.log("query:"+ timeDifference);
//var day = timeDifference.getDay();
//var day =parseInt(timeDifference);
gs.addInfoMessage("the time taken from 'new' to 'in progress' state of incident and display"+ timeDifference);
})(current, previous);