How to set SCTASK due date based on 2nd task "actual end" date in flow designer

Nandini DM
Tera Contributor

I have 3 SCTASK , I have a requirement to set 3rd task due date to after 5 days based on 2nd task "actual end" date How to set SCTASK due date based on 2nd task "actual end" date in flow designer

Please help.

1 ACCEPTED SOLUTION

Tai Vu
Kilo Patron
Kilo Patron

Hi @Nandini DM 

At the step you create the 3rd sctask, you can use script to calculate the due date based on the actual end date of 2nd sctask.

Sample below.

TaiVu_0-1701099443283.png

//replace <_5__create_catalog_task> by the step of 2nd sctask
var previous_task_actual_end = fd_data._5__create_catalog_task.catalog_task.work_end;
var gdt = new GlideDateTime(previous_task_actual_end);
gdt.addDays(5); //number of days
return gdt.getDisplayValue();

 

Cheers,

Tai Vu

View solution in original post

4 REPLIES 4

Tai Vu
Kilo Patron
Kilo Patron

Hi @Nandini DM 

At the step you create the 3rd sctask, you can use script to calculate the due date based on the actual end date of 2nd sctask.

Sample below.

TaiVu_0-1701099443283.png

//replace <_5__create_catalog_task> by the step of 2nd sctask
var previous_task_actual_end = fd_data._5__create_catalog_task.catalog_task.work_end;
var gdt = new GlideDateTime(previous_task_actual_end);
gdt.addDays(5); //number of days
return gdt.getDisplayValue();

 

Cheers,

Tai Vu

Nandini DM
Tera Contributor

HI @Tai Vu 
Getting below error

NandiniDM_0-1701100411492.png

 

Hi @Nandini DM 

It's most probably because wrong syntax in your script. Can you help to capture the steps in your flow between 2nd and 3rd tasks?

 

Ref: Inline scripts

 

Cheers,

Tai Vu

Nandini DM
Tera Contributor

@Tai Vu Thank you ,it is working now ðŸ˜€