- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 03:23 AM
In an onchange script on variable 'name_of_var', how can I get the name of that variable inside the script?
For example in this code:
var field = ???
g_form.hideFieldMsg(field, true);
<check something>
g_form.showFieldMsg(field, msg, 'error');
What should I put into the first line to get the name of the variable on which this current CCS is running?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 04:28 AM
I understand.
Maybe, some tweak : you "hardcode" the Sys_id of the variable name.
The name could change but the sys_id will remain unchanged.
With a GlideRecord, you can get the variable name from its sys_id.
From Where catalog variable's value are stored ? , it seems that the varaible table is : sc_item_option_mtom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 03:29 AM
Hello Peter,
use g_form.getValue("variabloe name");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 03:38 AM
How does this function get me the variable name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 03:50 AM
oops. I understood the question wrong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 04:09 AM
Try this:
g_form.getLabelOf('variable name'); // see the syntax once
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#getLabelOf