How to get all catalog variables from Script Step in a custom action in Action Designer in Flow Designer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2021 07:13 AM
Hi!
I'm currently trying to convert a Workflow to a Flow, where one of the steps of the workflow is to set RITM variables based on the existance of catalog item variables.
Example:
I wish to do this if-statement check in a custom action, so that it can be re-used for each catalog item. Therefore I do not wish to use the "Get catalog variables" action for each catalog item.
What I'm wondering is:
- Is there a way for me to use something similar to Workflow's "current.variables" in a custom script step?
- Is there a way to retrieve all catalog item variables through a custom script step, and then apply the variable values to RITM fields based on the catalog variable existance?
Any help is appreciated 🙂
- Labels:
-
flow designer
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2021 07:31 AM
Hi,
so you want to populate all variable details on RITM description.
you can pass the RITM record sys_id to that custom action
then query RITM and get all the variables in this syntax
var gr = new GlideRecord('sc_req_item');
if (gr.get(inputs.sys_id)) {
var variables = gr.variables.getElements();
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion();
gs.info(question.getLabel() + ":" + question.getDisplayValue()) ;
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader