We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Get Catalog Variable action not working for Variable set Choice Field

Not applicable

Hello Community,

 

I am using get Catalog Variable out of the box action of  flow designer. I am giving the Variable set name in this action.
I am facing issue with choice variable  of the Variable set.

 

When I am selecting that variable choice is coming as none. 

Can anyone please help me in this? if we need to create the custom action, can anyone please guide me on this?

3 REPLIES 3

Dr Atul G- LNG
Tera Patron

Hi @Community Alums 

 

Please share some screenshot.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Rajdeep Ganguly
Mega Guru


Sure, I can guide you on how to create a custom action in ServiceNow Flow Designer. Here are the steps:

1. Navigate to Flow Designer in ServiceNow.
2. Click on "New" and select "Action".
3. Provide a name for the action and select the application scope.
4. In the "Inputs" section, define the inputs required for your action. In your case, it would be the sys_id of the catalog item and the variable set name.
5. In the "Steps" section, you can add the logic for your action. You can use the scripting APIs provided by ServiceNow to fetch the catalog variable. Here is a sample code snippet:

javascript
(function execute(inputs, outputs) {
var gr = new GlideRecord('item_option_new');
gr.addQuery('cat_item', inputs.sys_id);
gr.addQuery('variable_set', inputs.variable_set_name);
gr.query();
if (gr.next()) {
outputs.choice = gr.choice;
} else {
outputs.choice = 'None';
}
})(inputs, outputs);


6. Once you have added the logic, you can save the action.
7. Now, you can use this custom action in your flow. When you add an action in your flow, you can select this custom action from the list.

Please note that the above code is a sample and might need to be adjusted based on your exact requirements. Also, make sure to test the custom action thoroughly before using it in production.

Ankur Bawiskar
Tera Patron

@Community Alums 

no custom action required.

Please share the RITM submitted screenshot. Did you verify if that variable has value in it?

Please share screenshot of the flow step

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