- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 06:30 AM
Hi,
I am trying to set the date of CAB date field in the change_request record using before business rule and it is not working, nothing is populating in the field. Below is my script:
(function executeRule(current, previous /*null when async*/ ) {
try {
var gdt = new GlideDateTime(gs.beginningOfNextWeek());
gdt.addDaysLocalTime(2);
current.setvalue('cab_date_time', gdt);
} catch (err) {
gs.error("A runtime error occured:" + err);
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 06:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 06:37 AM
Hello @faraaz
Try this:
(function executeRule(current, previous /*null when async*/) {
try {
var gdt = new GlideDateTime(gs.beginningOfNextWeek()); // Gets Sunday of next week
gdt.addDaysLocalTime(2); // Add 2 days to get Tuesday
current.setValue('cab_date_time', gdt); // Make sure "setValue" is camelCase
} catch (err) {
gs.error("A runtime error occurred: " + err);
}
})(current, previous);
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2025 06:46 AM
Thank you!