Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Flow Designer: 'Create Catalog Task' - need help to script the short description

danielalexa
Tera Contributor

Hi,

 

First time posting - I am looking for guidance how to correctly script a custom short description that shall pull the variable display text values correctly.

 

The variables: for simplicity renamed to "var1" and "var2"

 

What I have right now is currently throwing "undefined" errors:

 

return "License Request - " + fd_data._1__get_catalog_variables.var1.getDisplayValue() + " - " + fd_data._1__get_catalog_variables.var2.getDisplayValue() + " License";
 
This shall currently create tasks correctly yet show as "License Request - undefined - undefined License"
1 ACCEPTED SOLUTION

HarishKumar6668
Kilo Sage

Hi @danielalexa ,

If it is a Reference variable, you can use dot-walking to retrieve the display value. Assuming the Requester variable references the User table, you can use:

fd_data._1__get_catalog_variables.requester.name

 
If it is a Select Box variable, you can dot-walk through the RITM to retrieve the variable's display value. In the example below, we are accessing the RITM through the Flow Trigger and then retrieving the display value of the variable:

fd_data.trigger.request_item.variables.<varname>.getDisplayValue();   

 

If you find this information useful, please mark it as Helpful and Accept the Solution.


Regards,
Harish 

View solution in original post

5 REPLIES 5

prajaktakha
Tera Expert

Hello @danielalexa ,

 

With flow designer you can achieve this use case :

Suppose you have a catalog item called License Request with these variables:

 

Variable Type Example selected value
softwareReferenceMicrosoft Office
license_typeSelect BoxPremium

 

Step 1: Trigger

Create/open your Flow.

Use:

Trigger → Service Catalog

prajaktakha_0-1787689167053.png

 

Step 2: Get Catalog Variables

Add an action:

ServiceNow Core → Get Catalog Variables

 

prajaktakha_1-1787689215676.png

 

Step 3: Create the Catalog Task

Add:

ServiceNow Core → Create Record

prajaktakha_2-1787689274041.png

You can customize the short description then after the submission of catlog item output will look like this:

prajaktakha_3-1787689339276.png


If you found this Helpful please Accept the Solution and mark it as Helpful.

 

Thanks,

Prajakta

Ankur Bawiskar
Tera Patron

@danielalexa 

what's that variable type for var1 and var2?

your logic is correct

did you add those 2 variables to right side while using "Get Catalog Variables" flow logic?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Yes, the first action of my flow is to get all variables added.

Both variables are simple select boxes with question choices. What I need from the "getDisplayValue()" is the 'Text' and not the 'Value' - yet the above so far throws "undefined" for both.

HarishKumar6668
Kilo Sage

Hi @danielalexa ,

If it is a Reference variable, you can use dot-walking to retrieve the display value. Assuming the Requester variable references the User table, you can use:

fd_data._1__get_catalog_variables.requester.name

 
If it is a Select Box variable, you can dot-walk through the RITM to retrieve the variable's display value. In the example below, we are accessing the RITM through the Flow Trigger and then retrieving the display value of the variable:

fd_data.trigger.request_item.variables.<varname>.getDisplayValue();   

 

If you find this information useful, please mark it as Helpful and Accept the Solution.


Regards,
Harish