- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 02:27 AM
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.
Thank You,
Sai.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2020 01:24 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 04:12 AM
Can you please help on this.
Thank You,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 04:28 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 04:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 05:22 AM
in 1st line, correct the code.. it should be fd_data.trigger