Issue with Accessing Variable Value in Variable Set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:48 AM
Hello,
I need help retrieving the value from a Variable Set.
Here's what I’ve tried so far, but it’s not triggering the alert. Thank you
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var applicationName = g_form.getDisplayValue('business_application');
if (applicationName === 'Maximo') {
alert(applicationName);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:57 AM - edited 07-17-2025 08:58 AM
@Lisa Goldman it is nothing to lose, please try to change the UI Type from Desktop to All and retry...
and eventually "Applies on Catalog Item view" to true.
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 09:26 AM
Hi @GlideFather ,
I had already tried changing the UI Type to "All" before reaching out to the community for help, but unfortunately, it's still not working after the change. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 09:39 AM
@Lisa Goldman And also the catalog view to true?
you can try the alert on the first line:
alert(“script triggered ok”);
to see if it is not blocked by your browser as a pop-up.
or use g_form.addInfoMessage(“test”);
sorry i am on my mobile phone so the quotes might not be correct…
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 09:16 AM
Hi @Lisa Goldman ,
is business_application a reference field?
getDisplayValue doesn't work in this case (it returns the current record's displayValue)
you have to use
g_form.getDisplayBox('business_application').value
or GlideAjax or getReference or GlideRecord
I would say go with GlideAjax to check the value (the other 3 getDisplayBox and getReference and GlideRecord API won't work in the portal)
if not against name you can compare with sysId (of Maximo) in the if condition
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var applicationName = g_form.getValue('business_application');
alert(applicationName);
if (applicationName === 'Maximo') {
alert(applicationName);
}
}
also set the UI to ALL
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya