javascript needed for reference qualifier for lookup value field dependent on more than one variable

patricklatella
Mega Sage

hi Community,

I'm setting up a series of fields on a catalog item that have choices dependent upon previous fields.   I've setup mapping tables to establish the relationships between the fields and am using "Lookup Select Box" type variables for the fields.   I've got the fields working properly that have choices that are dependent upon only 1 other field.   However I'm struggling with the reference qualifier script for the variables that are dependent up on more than 1 of the other fields.  

for example, for a field that is dependent upon one other field I've got the following:

variable name: profit_center_group

dependent upon the choice selected in the field: profit_center_segment

reference qualifier script: javascript: 'profit_center_segment='+current.variables.profit_center_segment //the first variable name here is the column on the associated mapping table and the second is the variable name on the form

THIS IS WORKING

so for a field that is dependent upon the values of 2 other fields I've got the following:

variable name: project_profile

dependent upon the choice selected in the BOTH these fields: profit_center_segment AND profit_center_group

reference qualifier script = ???

MY QUESTION IS what is this reference qualifier script for this variable?

so far I've got: javascript: 'project_profile='+current.variables.project_profile+current.variables.profit_center_group

but this is not working.  

Anyone got advice?   thanks!

javascript: 'profit_center_segment='+current.variables.profit_center_segment

1 ACCEPTED SOLUTION

Realized I was using the wrong piece. Disregard the last post. Try this instead:




javascript:'profit_center_segment=' + current.variables.profit_center_segment + '^profit_center_group=' + current.variables.profit_center_group;


View solution in original post

13 REPLIES 13

patricklatella
Mega Sage

the project_profile variable is a "Lookup Select Box" type...which to my understanding is a type of reference field?



find_real_file.png


You indicate that you have three fields in your custom look-up table. What are the field types for those fields?



What is the expected behavior on your form? It sounds like you have two Select Boxes that are used to show a third Select Box, correct?


patricklatella
Mega Sage

so when I go to the list of records on my project profile mapping table and do a filter condition based on one choice from the profit_center_segment column and one choice from the profit_center_group column it shows the filtered records correctly and when I right click copy query I get the following:



profit_center_segment=a7ec6e3e4fb7b64089c7029d0210c764^profit_center_group=1b7633764f7bb64089c7029d0210c71d



when I enter this script in the reference qualifier for the project_profile variable the field on the form correctly displays the choices associated with this combination of choices from the profit_center_segment and the profic_center_group fields. (again, based on that ref. qual.)



So I'm assuming that some tweak to this script will get me there?



profit_center_segment=a7ec6e3e4fb7b64089c7029d0210c764^profit_center_group=1b7633764f7bb64089c7029d0210c71d



just not sure what changes I need to make.


Replacing the static sys_id values with the dynamic values pulled from the other variables (I am guessing that the variable names match the field names from the lookup table) I have the following:


javascript:'project_profile=' + current.variables.project_profile + '^profit_center_group=' + current.variables.profit_center_group


Hopefully that will work as expected.


Realized I was using the wrong piece. Disregard the last post. Try this instead:




javascript:'profit_center_segment=' + current.variables.profit_center_segment + '^profit_center_group=' + current.variables.profit_center_group;