- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 05:19 AM
Hello All
I need your precious help again 🙂
I've created a field on the task table called "Reaction Time".
I need this field to be a calculation between the ticket creation and the first status change.
I already created a field that does the calculation between sys_created_on and requested date but I have to admit that I don't know how to achieve this new one.
Here is my first script
runCalculateTime();
function runCalculateTime() {
var laterDate = new GlideDateTime(''+current.sys_created_on);
var earlierDate = new GlideDateTime(''+current.requested_by_date);
var duration = new GlideDuration();
duration = GlideDateTime.subtract(earlierDate, laterDate);
current.u_ticket_creation_delay = duration;
How can I catch up the first status change ?
Thanks
Jérôme.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 05:37 AM
Hi
You can try an AFTER UPDATE business rule as below
Condition : 'Status' Changes
AND
'ReactionTime' IS NOT EMPTY
Script:
var created = new GlideDateTime(''+current.sys_created_on);
var updated = new GlideDateTime(''+current.sys_updated_on);
var duration = new GlideDuration();
duration = GlideDateTime.subtract(created, updated);
current.u_reaction_time = duration; //update your reaction time field name
current.setWorkflow(false);
current.update();
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 05:37 AM
Hi
You can try an AFTER UPDATE business rule as below
Condition : 'Status' Changes
AND
'ReactionTime' IS NOT EMPTY
Script:
var created = new GlideDateTime(''+current.sys_created_on);
var updated = new GlideDateTime(''+current.sys_updated_on);
var duration = new GlideDuration();
duration = GlideDateTime.subtract(created, updated);
current.u_reaction_time = duration; //update your reaction time field name
current.setWorkflow(false);
current.update();
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
