Use different choice lists for same field with UI policies - Catalog Item (Record Producer)

Susanne Bredal
Tera Contributor

Hi all, 
I hope I picked the correct board to ask my question 🙂

I have created a catalog item, with a record producer, where I would like to populate the same field with different choice lists (select box), depending on the outcome chosen in the field before.
So I made a Variable set with a select box for Function. When a function has been selected then the next field should display the relevant choice list for this Function. 

SusanneBredal_1-1777984226020.png

 

So number 1 is where the Function is selected. 
Then number 2, 3 and 4 is the Function variables with the Choice lists.
So if Audit is selected in Function, then the choice list from variable 2 should display.
I have created UI policies for the dependencies, but it's working like the wild west! 

SusanneBredal_2-1777984513621.png

Can anyone give me a hint to why it's not working as expected?

SusanneBredal_3-1777984564067.png

SusanneBredal_4-1777984646429.png
SusanneBredal_5-1777984670400.png
SusanneBredal_6-1777984715419.png

SusanneBredal_7-1777984735932.png

Thanks 🙂
BR, Susanne

3 REPLIES 3

Yousaf
Giga Sage

Hi @Susanne Bredal 
Hope you are doing well. I think we cannot leverage native UI dependency solution that works on incident in this scenerio. So if the choices are not many and its nothing very complex you can simply use onChange Client scripts to clear values using clearOptions and then adding your choices in the script using addOptions
Let me know if you need more information


***Mark Correct or Helpful if it helps.***

Something like this 


function onChange(control, oldValue, newValue, isLoading) {
// If the form is loading or the field is cleared, reset Variable B
if (isLoading || newValue === '') {
g_form.clearOptions('access_level');
g_form.addOption('access_level', '', '-- None --');
return;
}

// 1. Clear all existing options to start fresh
g_form.clearOptions('access_level');
g_form.addOption('access_level', '', '-- None --');

// 2. Add options based on the selection in Variable A
if (newValue == 'finance') {
// g_form.addOption('variable_name', 'value', 'label');
g_form.addOption('access_level', 'billing', 'Billing Admin');
g_form.addOption('access_level', 'reporting', 'Financial Reporting');

} else if (newValue == 'it') {
g_form.addOption('access_level', 'admin', 'System Admin');
g_form.addOption('access_level', 'help_desk', 'Help Desk Agent');
g_form.addOption('access_level', 'security', 'Security Analyst');

} else if (newValue == 'hr') {
g_form.addOption('access_level', 'payroll', 'Payroll Specialist');
g_form.addOption('access_level', 'recruiter', 'Recruiting Lead');
}
}

***Mark Correct or Helpful if it helps.***

salma98
Tera Contributor

Hi @Susanne Bredal . As @Yousaf suggested, you will have to use catalog client script for the dropdown values. Catalog UI Ploicies are mainly for making fields read-only, mandatory and visible.