How to subtract to dates and the populate the outcome in a Duration type field
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2024 12:48 AM
Hi,
I have the field updated and the field date_move_to_pending both of type Date/Time. I want to subtract date_move_to_pending from updated and then populate the outcome in the field Resolve time of type Duration.
How can I achieve that?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2024 01:10 AM
Hi @Alon Grod ,
Please write a Before Update BR on your required table and use the script shared below:
var diff = GlideDateTime.subtract(current.date_move_to_pending.getDisplayValue(), current.sys_updated_on.getDisplayValue());
var diffString = diff.getDisplayValue();
current.resolvedFieldName = diffString;
Please adjust field names as required in above script.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke