- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 09:46 AM - edited 07-13-2023 09:48 AM
Hi All,
I am having issue trying to make the duration field on sc_task work, I understand that duration fields are not calculated on task table by default but was wondering if I could make it work by using the BR from the incident table and replicating it on either the task or sc_task table? Is this possible when the task state is set to closed_complete, if so please provide the customised script.
Thank you in advance,
Jana
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 10:54 AM
Hi @Jana_S
You can use BR with script like below that will trigger when state changes to closed complete
var startDateTime = current.sys_created_on.getGlideObject(); //use your start date/time field
var endDateTime = new GlideDateTime();
current.duration = gs.dateDiff(startDateTime.getDisplayValueInternal(),endDateTime.getDisplayValueInternal(),false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 10:54 AM
Hi @Jana_S
You can use BR with script like below that will trigger when state changes to closed complete
var startDateTime = current.sys_created_on.getGlideObject(); //use your start date/time field
var endDateTime = new GlideDateTime();
current.duration = gs.dateDiff(startDateTime.getDisplayValueInternal(),endDateTime.getDisplayValueInternal(),false);