- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 08:51 AM
I have a Multiple Choice Variable on a Catalog Item named "Role Selection (role_selection)", that has 3 possible values, as shown below:
In Flow Designer, I am trying to display the Text of this selection in the Comments of an Approval that is being created. I am doing that with an "Update" action in my Flow, to update the Comments field on the Approval record. I am using the "Script" option on the Comments field, and as getting the Role Selection like this:
var role = fd_data._1__get_catalog_variables.role_selection;
The issue is this returns the "Value", not the display "Text". So it returns "sourcing_manager" instead of the desired "Sourcing Manager".
I though maybe I could update that variable like this:
var role = fd_data._1__get_catalog_variables.role_selection.getDisplayValue();
but that does not work. It returns an error, saying:
Error: Cannot find function getDisplayValue in object company_administrator.,Detail: Cannot find function getDisplayValue in object company_administrator.
How can I code this to return the "Text" value and not the "Value" value?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 09:22 AM
Please take a look at - https://www.servicenow.com/community/developer-forum/retrieve-display-variable-value-in-flow-designe...
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 09:22 AM
Please take a look at - https://www.servicenow.com/community/developer-forum/retrieve-display-variable-value-in-flow-designe...
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 09:42 AM
Thank you! That method worked! I had to rewrite it as:
var role = fd_data.trigger.request_item.variables.role_selection.getDisplayValue();
and it worked!