Why ist getValue() not working in scope apps?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 08:38 AM - edited 03-01-2023 08:46 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 02:02 AM
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);
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 06:54 AM
I tried this and it worked.
g_form.getValue(<drop down field>);
What is the error you are getting?
Regards,
Shamma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2024 11:16 PM
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 ...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 10:12 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 01:33 AM
please try to get a value of a Choice VAr with get Value in a Scope App.