Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

client script and Display value

Nauman Chaudhry
Tera Contributor

client script on incident

 

I am getting back state value as 7 when I use g_form.getValue('state')  but I need the display value. When I use

function onLoad() {

   //Type appropriate comment here, and begin script below

              

               var stateName = g_form.getDisplayValue('state');

   alert('My state is ' + stateName); 

}

I get back incident number I guess an object. How can I can I get the display value in client script.

 

7 REPLIES 7

Mohith Devatte
Tera Sage
Tera Sage

hello @Nauman Chaudhry ,

try this 

var u_stateLabel = g_form.getOption('state',7).text;

This works but in this case I need to define each state i guess. eg.

g_form.getOption('state',7).text;       //I get closed in the alert

g_form.getOption('state',6).text;   .........

why cant I get displayvalue regardless of defining it first

@Nauman Chaudhry because get displayValue does not work in client scripts 

please mark my answer correct and close the thread so that it will be helpful for future readers and goes to solved queue

 

@Nauman Chaudhry any follow up required or all working ?

if working close the thread by marking the answer correct and push it to solved queue

Thanks

good day !