unable to get the field value on server side script

NiloferS
Tera Contributor

I have writing a background script to print the choice of a selectbox variable called "bussiness items" of a catalog item. its giving me the backend value of the choice instead of the display value.

How to get the display value of the choice and not the backend value.

Kindly suggest.

NiloferS_0-1721667993158.png

 

2 REPLIES 2

SN_Learn
Kilo Patron
Kilo Patron

Hi @NiloferS ,

 

Could you please share the screenshot of the variable where it shows the name?

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Community Alums
Not applicable

Hi @NiloferS ,

I tried your problem in my PDI, 

I don't think there is any error in your code just check once in your variable what is your frontend value and backend value are they same? If they are same it gives the same everytime 

For exmaple 

Here if you see in Question Choices there are two column Text and Value 

 

Here Text contains the Frount End value and 

Value contains the banckend value that we use in our scripting

SarthakKashyap_1-1721670611150.png

 

For reference my script 

 

var gr = new GlideRecord("sc_req_item");
gr.get("f61b28f147a30210b1613b12d16d4349");
gs.print("DISPLAY VALUE = "+ gr.variables.business_unit_choice.getDisplayValue());
gs.print("Backend VALUE = " + gr.variables.business_unit_choice);

Result 

SarthakKashyap_0-1721670492452.png

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak