How to Access Catalog Item Variable from Variable Set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 01:22 PM
I have an Order Guide that has a variable at that level named "enrollment_type".
Under my Order Guide, I have a Catalog Item named "Basic Commercial Enrollment".
Under the Catalog Item, I am using 3 different Variable Sets.
In one of my variable sets, I need to write a Catalog Client Scripts. I want to use the "enrollment_type" variable in that script. How do I access it from this level?
Thanks
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 01:24 PM
Have you tried:
g_form.getValue('variables.variablename')
?
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 01:30 PM
I had actually tried it without the "variables." in front of the variable name at first, but neither one seems to work.
This is my latest attempt:
var enroll_type=g_form.getValue('variables.enrollment_type');
alert('Enroll type: ' + enroll_type);
The pop-up alert returned:
Enroll type:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 05:58 AM
I am not sure if this makes any difference, but the variable in my Order Guide is a List Collector.
I understand that means that I may need to split it and loop through it to ultimately check for my value, but my testing "alert" should return a string with all the selections separated by a comma, right? (if it was working correctly)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 05:35 AM
OK, I solved this by coming at it from a different angle with the following workaround.
Since each Enrollment Type listed in the Order Guide Variable will have its own Catalog Item, I created an invisible variable on the Catalog Item where I store the sys_id of that particular enrollment type, and then feed that variable into my Catalog Client Script.
It is a little bit of a pain, in that we need to hard-code this hidden field for each Catalog Item, but at least then we still only have to have one Variable Set pertaining to this, with one Catalog Client Script, and one Script Includes that can be re-used over and over.