Run Script to set Due Date on RITM

booher04
Tera Guru

We have a need to update the RITM Due Date after a SCTASK is closed(there is a date variable that is selected on this task).  Once the date/time variable is selected, the task is closed, and we want the RITM Due Date to match the variable date/time selected.  I put in a run script after that task is closed on the workflow but it's only setting the tasks that follow the 1st task to that due date.  The RITM due date doesn't change.

Here's the run script:

current.due_date = current.variables.test_scan_target_date;

find_real_file.png

I was thinking I needed to use current.request_item.due_date = current.variables.test_scan_target_date; but that doesn't work at all and gives an error on the workflow.

1 ACCEPTED SOLUTION

Hello,

Firstly, please mark those replies above as Helpful, if they were...as you can see I did quite a bit of work on that.

Secondly, did the due date change? You didn't confirm that, but just said it "seems to let the run script work". As far as the tasks after it showing as cancelled, I'm not understanding how this run script has to do with that, but what you can also try to do is add a 1 second timer activity right after the run script to let the workflow breath for a second.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

12 REPLIES 12

After adding the 1 second timer, the current.due_date = current.variables.test_scan_target_date; worked correctly.  I had to add task.current.due_date = current.variables.test_scan_target_date; script to the tasks in order to get the due date to match those as well.  

 

Thank you for the help with this!  I appreciate it.

Hi,

Great. Yea, you didn't previously mention anything about setting the task due dates?, but yes, doing that line like you mentioned will accomplish that.

Anyways, glad it's all resolved, haha.

Please mark any other reply as Helpful if it was.

Take care!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Ankush Jangle1
Kilo Guru

Hi,

try this code

 

var gdt = new GlideDateTime(current.variables.test_scan_target_date);

current.due_date=gdt;

current.update();

 

Please mark it As Correct/Helpful if it Helps you