The CreatorCon Call for Content is officially open! Get started here.

How to retrieve variable values in Flow Designer

NiharikaC
Tera Contributor

I'm working with Flow Designer and have a subflow that creates a Catalog Task. On the catalog form, there is a server field, which is a lookup select box pulling from cmdb_ci_server . I need to populate the Configuration Item(cmdb_ci) field in the Catalog Task with the value the user selected in the server field while submitting the request. However, when I try using the script below, I receive the error "cannot read property 'variables'".

Could someone guide me on how to correctly pass the value from the server field to the Configuration Item field in the Catalog Task?

var field1 = fd_data.trigger.current.variables.variable_name;

  

2 ACCEPTED SOLUTIONS

Jon23
Mega Sage

Hi @NiharikaC,

Instead of using a script, use the flow action 'Get Catalog Variables'. 

You can then use the catalog variable data pill in your catalog task.

Jon23_0-1736294547555.png

 

View solution in original post

Amit Verma
Kilo Patron
Kilo Patron

Hi @NiharikaC 

 

Please follow the below approach to achieve your requirement :

 

1. Create a Subflow which will be responsible to create the catalog task. Inside the Subflow, you need the input RITM and the server field value which will be passed from the catalog item.

AmitVerma_0-1736309261229.png

 

AmitVerma_1-1736309284591.png

 

AmitVerma_2-1736309311819.png

 

Save and publish the Subflow.

 

2. Create a flow with Trigger Type as Service Catalog. Inside the flow, make use Get Catalog Variables action to get the server field value submitted by the requestor followed by calling your Subflow.

 

AmitVerma_3-1736309425234.png

 

AmitVerma_4-1736309444256.png

 

AmitVerma_5-1736309477164.png

Output -

AmitVerma_6-1736309543204.png

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

3 REPLIES 3

Jon23
Mega Sage

Hi @NiharikaC,

Instead of using a script, use the flow action 'Get Catalog Variables'. 

You can then use the catalog variable data pill in your catalog task.

Jon23_0-1736294547555.png

 

Juhi Poddar
Kilo Patron
Kilo Patron

Hello @NiharikaC 

Try this

return fd_data.trigger.request_item.variables.variable_name.getDisplayValue()

 

If this helped please hit like and mark it as an accepted solution. It helps future readers to locate the solution easily in community.

 

Thank You 

Juhi Poddar 

Amit Verma
Kilo Patron
Kilo Patron

Hi @NiharikaC 

 

Please follow the below approach to achieve your requirement :

 

1. Create a Subflow which will be responsible to create the catalog task. Inside the Subflow, you need the input RITM and the server field value which will be passed from the catalog item.

AmitVerma_0-1736309261229.png

 

AmitVerma_1-1736309284591.png

 

AmitVerma_2-1736309311819.png

 

Save and publish the Subflow.

 

2. Create a flow with Trigger Type as Service Catalog. Inside the flow, make use Get Catalog Variables action to get the server field value submitted by the requestor followed by calling your Subflow.

 

AmitVerma_3-1736309425234.png

 

AmitVerma_4-1736309444256.png

 

AmitVerma_5-1736309477164.png

Output -

AmitVerma_6-1736309543204.png

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.