
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2024 11:10 PM
I have a variable called u_return_date, what I want to do is when someone submits their catalog item, the follow up field on the RITM is populated by getting the u_return_date value and adding 5 days to it.
eg: u_return_date is 01/07/2024 then make follow_up - 06/07/2024
What I have currently is a business rule on the sc_req_item table and is a before insert with the following script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var ReturnDate = g_form.getValue('current.u_return_date');
ReturnDate.addDays(5);
current.follow_up = ReturnDate;
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 12:08 AM - edited 06-26-2024 12:23 AM
Hi @Bidduam ,
You have used g_form which is client side API. Business rule is server side so it won't work.
Use the below it will work, I have tested in PDI.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var ReturnDate = new GlideDateTime(current.variables.u_return_date);
ReturnDate.addDays(5);
current.follow_up = ReturnDate;
})(current, previous);
Output:
Mark this as Helpful / Accept the Solution if this helps
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 12:51 AM
I have tested it again:
RITM OOB field:
Business Rule:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var ReturnDate = new GlideDateTime(current.variables.u_return_date);
ReturnDate.addDays(5);
current.follow_up = ReturnDate;
})(current, previous);
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 12:45 AM - edited 06-26-2024 12:45 AM
Hi @Bidduam ,
The 'Date start' field is variable of catalog item and follow up date is custom field I have created on RITM which is of date type field.
Could you please share the screenshot of your fields?
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 12:51 AM
I have tested it again:
RITM OOB field:
Business Rule:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var ReturnDate = new GlideDateTime(current.variables.u_return_date);
ReturnDate.addDays(5);
current.follow_up = ReturnDate;
})(current, previous);
Mark this as Helpful / Accept the Solution if this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 12:52 AM
@SN_Learn I don't know what happened the first time, but I went back and copied and pasted what you gave me again and this time it worked exactly as wanted.
I'm sorry to stuff you around and really appreciate the help - thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 12:56 AM - edited 06-26-2024 12:57 AM
Glad that it helped.
Mark this as Helpful / Accept the Solution if this helps.