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

To confirm...I went ahead and did this myself just to show you.

Sample RITM (showing you due date before the script happens):

find_real_file.png

Task with the field on it:

find_real_file.png

find_real_file.png

I'll fill it in for WAYYY in the future

find_real_file.png

Now I'll close the task

...and checking RITM due date:

find_real_file.png

And this is the workflow (just to show the initial steps):

find_real_file.png

Annnddd the script I used in the run script, which is what I figured you could use and not even need my script above:

find_real_file.png

So that's all you need.

However....for fun...I did my script too just to ensure I wasn't suggesting something that doesn't work and it does work:

find_real_file.png

With script:

find_real_file.png

But again, you shouldn't need to do that, but it is an alternative.

Please mark reply as Helpful/Correct, thanks!

 


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

1.) I do not have that in the script

2.) it's on the sc_req_item table.

3.) find_real_file.png

4.) Yes it's a true date/time field.

5.) Haven't set up logs yet. Here's the variable filled out on SCTASK. find_real_file.png

 

The script you provided seems to let the run script work, however the tasks after it runs are showing as "cancelled".  

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!

When I said it seemed to work I should of been more clear.  There was no error on the workflow activity, but the RITM due date did not change.  I'll add the timer and see if that helps.

Ok, sounds good.

Hopefully you have success. At this point, I'm wondering if there is something else going on because I've done pretty extensive work on this and give exact screenshots/examples of all testing I've done above.

If anything else has been helpful that I've replied with through this thread, please mark as Helpful.

Thanks!


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