Variable reference field based on another variable answer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 09:29 PM
Hi Folks, I have found a lot of similar questions online but none which have enabled me to return the right result.
I have a catalog item variable that has a select box with 7 answers. Name is bypass_var
I have another variable which is a location reference field.
Essentially I need a location removed from the location variable if the bypass_var selection contains the word global.
For example 2 of the 7 results are Pending global approval and Global documentation approved.
I have tried using different variations based on different docs but here is an example of one(will add the second qualifier when this first is working):
ref_qual_elements=bypass_var in the attributes
and a ref qualifier of javascript: current.variables.bypass_var+'=Pending global approval^name!=Darwin'
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 11:39 PM
Try this:
javascript: var refQual = ''; if (current.variables.bypass_var == 'Pending global approval' || current.variables.bypass_var == 'Global documentation approved') refQual = 'name!=Darwin'; refQual;
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2024 12:08 AM - edited 06-27-2024 12:10 AM
Hello @KLee19,
You can refer the below catalog Client script (Onchange var = checkbox)and update it according to your requirement:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var grCheck = g_form.getValue('bypass_var'); // add your checkbox variable name
var grLoc = g_form.getValue('location_var'); // add your location variable name
if (grCheck == 'global1....' || grCheck == 'global2....'){ // add choices names of checkbox variable that contains "global".
g_form.clearValue('grLoc');
}
}
Thank you!!
Dnyaneshwaree Satpute
Tera Guru