Scripting help in flow designer

Madhu5
Tera Contributor

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.

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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].

 

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