Populate variables based on other variable and based on select variable third variable populates

neha_rathore
Tera Contributor

We have three variables in a catalog referring to three different tables, for example

1st variable- should populate list from pillar table

2nd variable- should populate list from roles table

3rd variable- should auto-populate list from responsibilities tables

A new "Access Relationship" table has been configured to define a relationship between above three tables(Pillar, Role and Responsibilities".

so in catalog variables we need to populate the records in such a way that, if-

 

1sr Part- Pillar is selected as 'General Business', then only these three roles(attached screenshot) should be available to select in drop-down of variable role. if another pillar is selected then depending on that, values should change in Role variable.

 

2nd Part- And based on the role selected responsibilities mapped in new table should auto-populate. The variable is a list-collector and is read only.

 

neha_rathore_2-1694587646739.png

 

 

neha_rathore_3-1694587695615.png

neha_rathore_4-1694588404047.png

 

We have wrote one script include(Attached screenshot) to populate Roles based on the Pillar selected and added that script include as a reference qualifier in Role variable- Till Now everything is working correctly.

neha_rathore_5-1694588589154.png

then we wrote another script include and calling it from catalog client script to auto-populate responsibilities.

These two scripts are also working fine and auto-populating the responsibilities based on role selected, but when we wrote these two scripts and first script include and reference qualifier stopped working.

And now if first script is working then second script include is not and if second script include is working first one is not working.

Any help on this how we can make this work and variables will populate the list from relationship mapping table or any other workaround.

 

 

neha_rathore_6-1694588836003.pngneha_rathore_7-1694588873170.png

 

 

1 ACCEPTED SOLUTION

Venkatesh_N
Tera Guru

Hi @neha_rathore ,

For the Role variable, instead of going for a script include, add the below line in advanced reference qualifier :

javascript:'pillar='+ current.variables.pillar;

put a semicolon after the javascript keyword, ignore the auto correction of code &colon

Note : Also add the attribute  suggested by @Brad Bowman    as ref_qual_elements=pillar

Now you end up having one script include to populate Responsibilities. Hope it will work now.

I hope this helps. Mark my answer correct & Like Helpful, if Applicable.

Thanks!
Venkatesh Nekkanti

 

View solution in original post

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

I'm not really following when something is working or not, and this is tough to troubleshoot without the full scripts and variable definitions.  It looks like you have three separate variables determining the values for three more separate variables, so they shouldn't affect one another.  Ensure you don't have any other UI Policies or Client scripts affecting the three variables you are trying to set the list for.  Responsibilities in the Access Details section looks like a list field, so you just need to call the script include from your reference qualifier.  On this variable, be sure to add a variable attribute like:

ref_qual_elements=var_name

where var_name is the name of the first Responsibilities variable.  If you have any existing attributes, comma separate them.  This will ensure that the list filter is refreshed when the first Responsibilities variable changes.

Venkatesh_N
Tera Guru

Hi @neha_rathore ,

For the Role variable, instead of going for a script include, add the below line in advanced reference qualifier :

javascript:'pillar='+ current.variables.pillar;

put a semicolon after the javascript keyword, ignore the auto correction of code &colon

Note : Also add the attribute  suggested by @Brad Bowman    as ref_qual_elements=pillar

Now you end up having one script include to populate Responsibilities. Hope it will work now.

I hope this helps. Mark my answer correct & Like Helpful, if Applicable.

Thanks!
Venkatesh Nekkanti