Display value of catalogue variable in Flow Designer: a simple solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 08:05 AM
Some workarounds are available in the Community and in Support (e.g. KB0960074). As far as I could find, they are either not explicit or over complicated and I spent some time in finding out this simple workaround for not very experienced users.
1. Requirements and conditions
-------------------------------------
You have a " Get Catalog Variables" action for that ("Choice") catalogue variable and you want to use the display value of it, typically in an Update Record action.
2. Issue
---------
If you use the pill from the Get Catalog Variables, only the value corresponding to the choice of the user for that catalogue variable will be returned.
You need, though, the text corresponding to the selection by the user.
3. Simple solution
---------------------
3.1 Instead of dragging and dropping the pill, click the "Toggle scripting on for ..." button for the field where you would drop the pill.
3.2 After the default/standard commented lines (usually 7), add the following:
return fd_data.trigger.current.variables.<variable name>.getDisplayValue();
replacing <variable name> by the name of the catalogue variable in the Get Catalog Variables.
That's it, save and activate as usual.
3.3 If you need to concatenate, do it simply with the "+" notation, e.g.:
return fd_data.trigger.current.variables.<variable name>.getDisplayValue() + ' in ' + fd_data.trigger.current.variables.<other variable name in Get Catalogue Variables>;
Hope it helps
Flavio4
* Reference type variables can be "dot walked" and this issue does not apply to them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 05:11 AM
Hi Flavio4,
I just tried this answer it throws an error.
just one small change and it will work fine.
When we are writing "return fd_data.trigger.current.variables.<variable name>.getDisplayValue();" in code, we need to replace "current" with "request_item" and it works fine.
My updated line of script was "return fd_data.trigger.request_item.variables.<variable name>.getDisplayValue(); "
Everything else is spot on, thank you for sharing this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 06:43 AM - edited 10-23-2024 07:42 AM
@Flavio4 @Ghulam Gose Ala Yes agreed, "return fd_data.trigger.request_item.variables.<variable name>.getDisplayValue(); " works perfectly. Thanks to you both.
Was trying to build a short description from info entered on a Corporate Event form and this was the final version that worked perfectly, for future visitors.