- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 08:53 AM
I am trying to set the request due_date variable to a date variable the user picks on a form. I can't seem to get it to change on submission. I setup an onsubmit script trying to change it and it didn't work. I set a run script in the workflow and it didn't work. The goal is that the task sets its due date as the request due date which should be set to what the user inputs on the form but I can't seem to get it to get that value.
Thanks in advance for any help.
Edit:
I guess the screenshots are broken. The run script I tried is currently this:
current.due_date = current.variables.desired_due_date;
But I have done a couple of variations with no success.
The onsubmit I tried was this:
function onSubmit() {
//Type appropriate comment here, and begin script below
var desired = g_form.getValue('desired_due_date');
g_form.setValue('due_date', desired);
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 09:41 AM
Hey
If you are trying to populate Request's due date(and not RITM), then you will need to glide the request record to update.
Try below script in your run script activity:
var reqGR = new GlideRecord("sc_request");
reqGR.get(current.getValue("request"));
reqGR.setValue("due_date", current.variables.desired_due_date);
reqGR.update();
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 08:57 AM
Hello,
Image is broken, Can you attach image and also If you have script then paste it directly ?
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 09:04 AM
Edited the post if that clears things up. Thanks for letting me know.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 09:44 AM
Check Aman's reply and see if that works
Regards,
Musab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 09:19 AM
An onsubmit catalog client scrip will not update field on a table. You would need to use a before insert business rule on the sc_req_item table. If this is on all catalog items no condition would be needed but if this is only on a few then you would need to create a condition of which items needs to run on.
code would be as simple as due_date = current.variables.desired_due_date;