Set a Select Box value based on a checkbox and another select box option

Michelle P
Tera Expert

I am building an RITM, I am trying to write a catalog client script or UI policy that when the user selects Permanent Access AND checks the box for OnBase Capital Market that the type is set to All Capital Market Accounts, and read only or hidden.

MichelleP_0-1706909615757.png

 

I have tried a scripted UI Policy:

MichelleP_1-1706909806419.png

 

Catalog Client Script based on either the perm or checkbox variable:

 

MichelleP_2-1706910011211.png

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    if (g_form.getValue('onbase_cap' == 'true' || vs_permtemp == 'vs_permtemp_perm')) {

        g_form.setValue('type_capitalmarket_access', 'v_all_accts');
        g_form.setReadOnly('type_capitalmarket_access', true);
        g_form.setVisible('type_capitalmarket_access', false);
    }

-------

and tried

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {

        return;
    }
    if (newValue == "vs_permtemp_perm") {
        if (g_form.getValue('onbase_cap' == 'true')) {

            g_form.setValue('type_capitalmarket_access', 'v_all_accts');
            g_form.setReadOnly('type_capitalmarket_access', true);
        }
    }
    if (newValue == "") {

        if (g_form.getValue('vs_permtemp' == 'vs_permtemp_temp')) {
                g_form.clearValue('type_capitalmarket_access');

            }

        }
        }
-------
and 
if (isLoading || newValue == '') {
        return;
    }

    if (newValue == 'vs_permtemp_perm') {

        g_form.setValue('type_capitalmarket_access', 'v_all_accts');
        g_form.setReadOnly('type_capitalmarket_access', true);
        g_form.setVisible('type_capitalmarket_access', false);

    }
----
and tried
function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == 'true') {
        return;
    }

    if (g_form.getValue('vs_permtemp' == 'vs_permtemp_perm')) {

        g_form.setValue('type_capitalmarket_access', 'v_all_accts');
        g_form.setReadOnly('type_capitalmarket_access', true);
        g_form.setVisible('type_capitalmarket_access', false);

    }
 
 
None of them are working, where did I go wrong?
1 REPLY 1

Harish KM
Kilo Patron
Kilo Patron

Hi @Michelle P here is the sample script.

The onchange client script is on checkbox variable,

script:

    var getChoice = g_form.getValue('variablename');
    alert(getChoice);
    var getCheckBox = g_form.getValue('variablename');
    alert(getCheckBox);
    if (getChoice == 'choicevalue' && getCheckBox == 'true') {
        g_form.setValue('variablename', 'choicevalue'); //auto populate variable
    }
Regards
Harish