Why ist getValue() not working in scope apps?

Meloper
Kilo Sage

Do you have e technically knowledge about this?

 

What are the alternatives?

Hoe do i get the value of choice Variable or how to i get the display value of a choice variable or how do i get the string value?

 

I know we can use to String() but does it show the value oder displayvalue of a choice and what shows the opposite? 

12 REPLIES 12

Hi @Meloper ,

Not sure which scope you are trying but we can get the value of fields.

Example:

(function executeRule(current, previous /*null when async*/ ) {

    gs.addInfoMessage(current.category);//without GlideRecord

    var grInc = new GlideRecord('incident');
    grInc.addQuery('sys_id', 'e1852eab2f0f5d10b62555272799b6a6');
    grInc.query();
    if (grInc.next()) {
        gs.addInfoMessage('Catgeory ' + grInc.category); //with GlideRecord
    }

})(current, previous);

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

I tried this and it worked.

g_form.getValue(<drop down field>);

What is the error you are getting?

 

Regards,

Shamma

Regards,Shamma Negi

Correct - this is not working!!!  Using to .toString() where ever it might work is more reliable.

getValue() on a bool is returning 1 or 0 ... WTF ... cost me hours already till till out  ... 

OlaN
Giga Sage
Giga Sage

Hi,

In the GlideRecord class both the getValue method and the getDisplayValue method works. Both in Global and in Scoped apps. What's your issue?

please try to get a value of a Choice VAr with get Value in a Scope App.