How to write script in flow designer.

Sai25
Giga Guru

Hi All,

How to write script in flow designer.

I want to write the below code in flow designer,

var groupValue=gr.assignment_group.u_auto_close_duration;
var half = (groupValue/2).toFixed(2);
var roundingValue=Math.round(half);
var gDate = new GlideDate();
gDate.addDays(roundingValue);
gr.work_notes="This case has been marked Resolved. It will be auto closed on"+" "+gDate+" "+" if you do not take action.";

Here i want to write the script. Please help me how to write.

find_real_file.png

Thank You,

Sai.

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

Create custom action here so scripting will be done in custom action, and then you will use that action in your flow designer. 

 

Doc link for further details. 

 

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/flow-designer/concept...

 

 

View solution in original post

8 REPLIES 8

Sai25
Giga Guru

@Chuck Tomasi ,

 

Can you please help on this.

 

Thank You,

 

asifnoor
Kilo Patron

Hello Sai,

Try like this. check and change variables as per your code.

var groupValue=d_data.triggr.current.assignment_group.u_auto_close_duration;
var half = (groupValue/2).toFixed(2);
var roundingValue=Math.round(half);
var gDate = new GlideDate();
gDate.addDays(roundingValue);

var work_notes="This case has been marked Resolved. It will be auto closed on"+" "+gDate+" "+" if you do not take action.";
return work_notes;

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

 

Hi Asif,

I am getting an error like this. when i run the script

find_real_file.png

var groupValue=fd_data.triggr.current.assignment_group.u_auto_close_duration;
 
instead of d_data it should fd_data right.
 
 

Thank You,

Sai.

in 1st line, correct the code.. it should be fd_data.trigger