unable to get the field value on server side script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 10:07 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 10:23 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 10:52 AM
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
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
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak