- 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 04:03 AM
Hi,
I guess from this it is not possible.
It seems you must know the variable name to use it.
Just for the record, why do you want to dynamically get the "current" variable name on onchange script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2017 04:19 AM
It's a habit. I try to do as less hardcoding as possible. You never know if the name of the variable changes due to some reason (or if I make a typo, which could happen).
- 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 04:42 AM
Thanks Imrane.