- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 04:25 AM
I have two field "MI service restore(u_time_when_the_resolved_notif) and MI action due date(u_mi_action_due_date). I want to add 7 days to MI service restore and display in MI action due date.
I have written Business rule for this but it's not displaying the date.
Here is my code:
var gdt = new GlideDateTime(current.u_time_when_the_resolved_notif);
var aft= gdt.addDays(7);
gs.addInfoMessage("time after adding date: "+ aft);
current.u_mi_action_due_date = gdt.getDate();
current.update();
Can anyone help me on this.
Regards,
Sowmya
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 05:41 AM
ok then you have to do glide record here to update the column on incident task table.
eg:
var gdt = new GlideDateTime(current.u_time_when_the_resolved_notif);
gdt.addDaysLocalTime(7);
gs.addInfoMessage("time after adding date: "+ gdt.getDisplayValue());
var gr = new GlideRecord('incident_task');
gr.addQuery('incident',current.sys_id); // make sure the relationship field is parent or incident.
gr.query();
while(gr.next()){
gr.<your date field on incident task > = gdt.getDisplayValue();
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 05:56 AM
glad it helped, if your query has solved, kindly mark my answer as correct and close this thread.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 05:16 AM
also check any other script exist into your system to set the date time into u_mi_action_due_date field ?
are you sure the field name is correct ?
can you add some screenshot ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2021 02:54 AM
HI Community i would have a question and what solution would you suggest:
I have a requirement to set the Due Date Field based on the Case Priority what was set through an Priority Lookup Rule.
I have five Case Priority States and i thought over a Business Rule.
I want to add time to the current date and time - im currently not so good in JS and need a bit help or tips to process it best
1 - Critical = +4hours to the current Date and Time
2 - High = +12hours to the current Date and Time
3 - Medium = +24hours to the current Date and Time
4 - Low = +72hours to the current Date and Time
5 - Planning = +120 hours to the current Date and Time
Thank you if you have time for a quick response