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

OK I put that second script in for the reference qualifier on the project_profile variable, not working yet.   Wondering if my default value for the project_profile variable is correct with all this considered?   Right now I have:



ref_qual_elements=profit_center_segment, profit_center_group



look good?


patricklatella
Mega Sage

find_real_file.png


According to the wiki:


Dictionary Attributes - ServiceNow Wiki



The ref_qual_elements is separated by semicolons ;



try using the following:


ref_qual_elements=profit_center_segment;profit_center_group


patricklatella
Mega Sage

that was it!   awesome, so the final ref qual was:



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



and the default value was:


ref_qual_elements=profit_center_segment;profit_center_group



thanks Christopher!