- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 02-19-2020 09:37 PM
Flow Designer is the future of workflows within ServiceNow. They're like business rules on steroids. Concepts such as custom Actions allow an incredible degree of flexibility in building components to solve specific issues within your ServiceNow instance. The documentation on how to do this, though, is lacking.
Recently, I had to build an action that dynamically determined the approver for a particular record based on a series of criteria that required a script. The challenge was how to get the output variable to work seamlessly with other OOB flow actions. The key to solving this was understanding how ServiceNow manages its complex variety of input/output variables.
The first step was to develop the script to determine who should be the approver, but once that was done, all that was needed was to set the output variable to be that specific gliderecord.
var getApprover = new GlideRecord('sys_user')
if(getApprover.get(outputs.approver_sys_id)){
outputs.approver = getApprover;
}
Then when defining the output variables in the Flow Designer interface, the critical step was to set the variable type to reference.table_name
Then out-of-the-box Ask For Approval accepted the custom action output variable.
Have fun
- 6,080 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Peter,
I'm trying to do something similar.
Could you tell me where the script goes - is it in the script step or on the Action Output?
Thanks,
Clare
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This is seriously a terribly non-intuitive product. Same with UI Builder. They think they are making it easier but end up ruining it.
I have a string as an input variable, a script and an array.object as an output variable. Despite the input variable and script being accurate, I still do not get the output array object.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @amol_joshi ,
I am having the same issue where input as String and output String Array and not getting mapped to output variables. I did debug just above outputs.<output array> and could able to see the value.
Please share if you get any solution for this.
Thanks,
Kartheek