Issue with Accessing Variable Value in Variable Set

Lisa Goldman
Kilo Sage

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

 

LisaGoldman_0-1752767284855.png

 

 

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);
    }

}

   

28 REPLIES 28

Thank you of helping @Chaitanya ILCR 

 

The business_application field is a Lookup Select Box type.

 

LisaGoldman_0-1752770694937.png

 

 

What we're trying to achieve is: after the RITM is created, if the business_application value contains "Maximo" or "Office365", the Service Type field should be hidden, as shown in the screenshot.

 

LisaGoldman_1-1752770813306.png

 

Hi @Lisa Goldman ,

 

try this 

if it's not working please share the business_application variable screenshots 

would like to see the type specifications section

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }


    var applicationName = g_form.getDisplayBox('business_application').value;
    alert(applicationName);

    if (applicationName == 'Maximo') {
        alert(applicationName);

//if working add the logic to hide the variables
    }

}

 

you can use the GlideAjax approach to get the name or instead of name you can compare with sysids (Maximo) sysid Office 365 sysid

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

 

 

@Chaitanya ILCR 

I have tried your suggestion code and it still not working.   Here is the specification section for your review: 

 

LisaGoldman_0-1752772318122.png

 

How do use GlideAjax approach to get the name?

Hi @Lisa Goldman ,

try this

you should be able to see alerts this time

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        // return;
    }

    //Type appropriate comment here, and begin script below

    var applicationID = g_form.getValue('business_application');
    var applicationName = g_form.getDisplayBox('business_application').value;
    alert(applicationName);
    alert(applicationID);


    if (applicationName == 'Maximo' || applicationID == 'Maximo') {
        alert(applicationName);
        //add logic to hide 
    }

}

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

@Chaitanya ILCR 

I’d like to confirm where the code should be entered. Should it go in the Variable Set Catalog Client Script, as shown in the screenshot below? If so, it's currently not triggering.

 

LisaGoldman_0-1752773752926.png