- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2019 02:37 AM
Hello all,
I am trying to set the due date on all tasks via the workflow. I have managed to do this for the RITM and the REQ.
Any ideas please? I am trying with the below code and it's not liking it using a run script before the tasks are created.
var grCatTask = new GlideRecord('sc_task');
var gdtCatTask = current.variables.start_date;
current.due_date.setValue(gdtCatTask);
grCatTask.addQuery('sc_req_item', current.sys_id);
grCatTask.query();
if(grCatTask.next())
{
grCatTask.due_date = gdtCatTask;
grCatTask.update();
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2019 02:47 AM
Hi Shamir,
Use the below code is each of the Catalog Task Activity, hope that would work :-
current.due_date = task.due_date;
var request = current.request.getRefRecord();
request.due_date = task.due_date;
request.update();
This code would update the due date value on REQ, RITM & SC_TASK forms.
Another Way :-
In the Run Script provide the below code :-
request.due_date = current.variables.start_date;
request.update();
current.due_date = current.variables.start_date;
And on each Catalog Task write this in the Advanced Section :-
task.due_date = current.variables.start_date;
This would also help.
Hope this helps.
Mark the answer as correct/helpful if you are satisfied.
Thanks,
Angshuman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2019 02:45 AM
I would say , rather than writing a script . You can set it in catalog task activity . you can either set it by out of the box set values feature or by clicking on advance and use the 'task' object to set any field of created task . you can use your variable values as well .
Please let me know if there is any doubts ..
Please check the below screeshot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2019 02:47 AM
Hi Shamir,
Use the below code is each of the Catalog Task Activity, hope that would work :-
current.due_date = task.due_date;
var request = current.request.getRefRecord();
request.due_date = task.due_date;
request.update();
This code would update the due date value on REQ, RITM & SC_TASK forms.
Another Way :-
In the Run Script provide the below code :-
request.due_date = current.variables.start_date;
request.update();
current.due_date = current.variables.start_date;
And on each Catalog Task write this in the Advanced Section :-
task.due_date = current.variables.start_date;
This would also help.
Hope this helps.
Mark the answer as correct/helpful if you are satisfied.
Thanks,
Angshuman

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 05:30 AM
Using the script below, can we add some type of formula that the due date on the task would be the Request/RITM due date plus 3 days?
current.due_date = task.due_date;
var request = current.request.getRefRecord();
request.due_date = task.due_date;
request.update();
This code would update the due date value on REQ, RITM & SC_TASK forms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2019 02:57 AM
Thanks all, I settled in the end for adding a line on each task.
task.due_date = current.variables.start_date;