Scripting help in flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 02:18 AM
I am trying to call a script include from a script step in flow designer. I need help on how to send the input of the script step and return some values from the SI to assign them to output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 02:28 AM
Hi,
you can define the input variables and send those as function parameters to script include
the value returned from script include can be stored in output variables
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 02:29 AM
Hi,
example
(function execute(inputs, outputs) {
var glideFrom = new GlideDateTime(inputs.from);
var glideTo = new GlideDateTime(inputs.to);
var objValue = new ScriptInclude().functionName(glideFrom,glideTo);
outputs.duration = objValue;
})(inputs, outputs);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 02:39 AM
In my case the input is an arrayobject. Also in the script include do i need to create the function with parameters or just the functionName and get the parameters using this code this.getParameter(sysparm_glideFrom);
My structure looks like this as attached.Rulebase[0] will have rulebase[0,1,2,3....n].
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 05:28 PM
Hello Ankur, need help with scriptinlcude added in flow action without inputs..
by calling the script include i get the payload in json format as below. how to use the payload directly in flow action with post call.
scriptinclude output : array object which gives the below format dynamically when called
[{ "id" :"123", "date":03122021"},
"id" :"234", "date":03122021"},
"id" :"567", "date":03122021"}]
how to pass the above payload to rest flow action and get the response. payload changes dynamically