How to access a variable inside a variable set using Client script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2020 04:53 AM
I am trying to access a variable of a variable set using an On_change client script but not sure about the steps.
Var set name : on_behalf_of
Var name : caller_id - which refers to a table user_info
Tried using - var clrID = g_form.getValue('variables.caller_id'); but I could see an empty alert box when I try to print clrID . Attached the same for reference. Any idea would be useful.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2020 01:17 AM
Hello DD,
When using an onChange() catalog client script, it is linked to a particular variable instead of a field. Use the following syntax to obtain the value of a catalog variable. Note that the variable must have a name. Replace variable_name
with the name of the variable.
g_form.getValue('variable_name');
If my answer helps you Mark it as Helpful and Correct.
Thanks,
Namrata Khabale.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2020 04:10 AM
Hey,DD
To access a variable of a variable set using an On_change catalog client script you can use the variable name.
g_form.getValue('varible_name');
for example:
var clrID = g_form.getValue('caller_id');
alert(clrID);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2020 07:02 AM
Hey DD,
try this below code,
var clrID = g_form.getValue('caller_id');
alert(clrID);
it will show you the caller id value in alert box.
Please Mark Correct and Helpful if it is useful.
Regards,
Indrajit.