- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 10:03 AM
Afternoon community. I have a need to populate the due date on SCTASK based off of a date field variable(r_3716_distribute_notice) and then subtract 1 day from that date. I am trying to use a business rule for this but it's not populating correctly. I am sure I have something wrong in the code. I've tried many different codes on my own.
var gdt = current.r_3716_distribute_notice;
if (current.r_3716_distribute_notice){
gdt.gs.daysAgo(1);
task.due_date=gdt;
}
Also tried this:
var gdt = current.r_3716_distribute_notice.getGlideObject();
if (current.r_3716_distribute_notice) {
gdt.subtractDays(1);
current.due_date=gdt;
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2019 07:31 AM
Variables is on RITM.. you need to dot walk to ritm first
Here is the updated script
if(current.request_item.variables.r_3716_distribute_notice != undefined){
var gdt = new GlideDateTime(current.request_item.variables.r_3716_distribute_notice);
gdt.addDaysLocalTime(-1);
current.due_date = gdt;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2019 07:31 AM
Variables is on RITM.. you need to dot walk to ritm first
Here is the updated script
if(current.request_item.variables.r_3716_distribute_notice != undefined){
var gdt = new GlideDateTime(current.request_item.variables.r_3716_distribute_notice);
gdt.addDaysLocalTime(-1);
current.due_date = gdt;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2019 10:20 AM
This actually worked for me once I got the filter correct on the business rule.