I have How to show only few options (list of choices) on list collector on record producer

Mounika280
Tera Contributor

I have question 1: which is of type list collector ( it has list of choices/options) where user can select more than one value.
question 2:which is of type list collector ( it has list of choices/options) where user can select more than one value.
Based on question 1 answer, question 2 has has to display list of options.

I have tried using add option on catalog client script but it is not working.

Kindly suggest me

16 REPLIES 16

Mounika280
Tera Contributor

Mounika280
Tera Contributor

I didn't stored options/choices in custom table rather used the below approach.

step 1: created variable with "selectbox type" and created choices -> saved it and copy the sys_id
step2: update the type of the same variable to "list collector" and in reference qual provides 
question ="sys_id" from step 1.


ThandileS
Tera Contributor

1. List Collector is the correct variable type to use to more than one option

2. For this one you can use a List Collector still but filter out the options you don't want by: 

-Create a Hidden Variable on the same catalog item that will temporarily store the Q1 selected value make it a single line text type.

-Create a OnChange client script that will set the selected values on the hidden field:

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;

var selected = g_form.getValue('question_1'); // Comma-separated sys_ids
g_form.setValue('hidden', selected); 
g_form.setValue('question_2', ' '); 
g_form.refreshVariable('question_2'); 
}

 

- Write a Reference Qualifier to exclude options with the sysId's stored on the hidden value:

javascript: (function() {
var excluded = current.variables.hidden;
if (!hidden) return '';
return 'sys_idNOT IN' + excluded;
})()

 

 

 

-Please mark this as helpful if it helped

Hi @ThandileS ,
thanks. but i have few clarifications.
is the followinggscript should be added in question 2 ref qualifier?

javascript: (function() {
var excluded = current.variables.hidden;
if (!hidden) return '';
return 'sys_idNOT IN' + excluded;
})()

because i have already question=sys_id in reference qualifier