Show the select box variable label instead of the value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 08:49 AM
Hi All,
I just have query, we are using a multirow variable set, and we have a variable, so how do we show the variable label after selecting the choice from the select box instead of the value? We are getting data from a third party to show that is not storing in ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 08:58 AM
Hi @imkhan ,
Please get the list of possible values from the 3rd party and create those choices on the select box that you are using on the MRVS. Then Whenever you add data to MRVS, then it will reference properly and shows label.
Please mark my answer as helpful/correct if it solves your query.
Best Regards,
Pooja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 09:10 AM
Hi pooja,
We are not storing value and label, every time a fresh call is executed through the get method when the user opens the request catalog and then shows the select box
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 09:13 AM
Since you are getting the data from a third party and the selected value might be different from the label, you can use a Client Script (onChange or onLoad) to fetch and display the label.
Create an onChange Client Script
- Type: onChange
- Table: Select the catalog item or record producer
- Field: Select the reference to your MRVS variable
script will be something like below
var selectedValue = gForm.getValue('your_variable_name'); // Replace with actual variable name
var options = gForm.getOptions('your_variable_name'); // Get all available options
for (var i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
gForm.setValue('your_variable_name', selectedValue, options[i].text); // Set label instead of value
break;
}
}
Please mark correct/helpful if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 10:09 AM
Hi @imkhan,
If you are looking for no-code approach, you can try this:
- We can use "Value same as Label" in the select box:- When creating the SELECT BOX variable , keep Value and Label the same.
- Use a reference or lookup select box.
This way, when the user selects an option, the summary will also show the label instead of a different value.
NOTE: If the label and value must be different, then scripting is needed.
Please mark correct/helpful if this helps you.
Thank you,
Ananya