BCM OOTB - impact category values depends on the first question.

sjskl1
Tera Contributor

Hello Community,

I have a small issue, how to implement proper solution on BCM OOTB module.

I would like implement functionality in that way, when I chose value form first question (main question) ex. 0-4 then for the rest of lists will be available only 0-4 value for rest questions.
2nd example: When I chose 8-12 on the first question, then for rest list of questions will be visible values: 8-12, 4-8; 0-4.
Do you have idea how is the most optimal solution for this question ?
I'm looking for the most optimal resolution.

Kind reagrds,
Sebastian

sjskl1_0-1793355831936.png

 

1 REPLY 1

Tarun Rekandar
Tera Contributor

Hi @sjskl1,

 

You can achieve this using an onChange Client Script on the main question. When the user changes the main question's value, dynamically update the available options in the remaining questions using g_form.clearOptions() and g_form.addOption().

 

For example, if the main question is set to 8-12, the remaining questions will offer 8-12, 4-8, and 0-4.

 

Example Client Script:

function onChange(control, oldValue, newValue, isLoading) {
    var field = 'u_question_2';   // your field name

    var current = g_form.getValue(field);

    // 1. Clear all existing options
    g_form.clearOptions(field);
    g_form.addOption(field, '', '-- None --');

    // 2. Add options one by one based on the main question
    if (newValue == '0-4') {
        g_form.addOption(field, '0-4', '0-4');
    }
    if (newValue == '4-8') {
        g_form.addOption(field, '4-8', '4-8');
        g_form.addOption(field, '0-4', '0-4');
    }
    if (newValue == '8-12') {
        g_form.addOption(field, '8-12', '8-12');
        g_form.addOption(field, '4-8', '4-8');
        g_form.addOption(field, '0-4', '0-4');
    }

    // 3. Restore the old answer (only sticks if it is still in the list)
    g_form.setValue(field, current);
}


For a more maintainable solution:

  • Apply the same logic to all dependent questions.

  • If there are many questions, create a reusable function to avoid duplicating the code.

  • Consider clearing previously selected values that are no longer valid when the main question changes.

Important: Before implementing this, verify that the BCM questions use choice fields supported by g_form.clearOptions() and g_form.addOption() in the relevant UI. If these are standard catalog variables or fields rendered in a specialized BCM interface, the implementation may need to be adapted.

 

Accept the solution if it assisted you with your question & Mark this response as Helpful.

 

Regards,

Tarun