Add dynamic hrs to current date and time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 03:10 AM
Hi Team,
We have a due date on RITM ticket, there is Hours variable with integer type contains dynamic values. based on Hours variable value, we need to add hrs to current date and time then populate in due date.
for eg: Due date = Hrs + current date/time.
how it can be achieved?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 05:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 05:41 AM
Hi Shraddha,
I see in link they used static value 13 hrs for addition to date/time field. My concern hrs values will be dynamic here always

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 06:27 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 10:13 PM
@Ash41 --
Please write After insert BR
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sys_id);
gr.query();
if (gr.next()) {
var due_date = String(gr.due_date);
var gdt = new GlideDateTime(due_date);
var gtime1 = new GlideTime();
gtime1.setValue(gs.nowDateTime().slice(11));
gdt.add(gtime1);
gr.due_date = gdt.getValue();
gr.update();
}
})(current, previous);
Thank you!