Catalog form

Ram012
Tera Contributor
Hi ,
Two fields :
 
Type :Environment (cloud,gm,ga,ld,ps) : Multiple choice
Type : Search by account (email,account owner,windows) : Multiple choice
 
If the user selects search by account is "account owner" then it should be visible (cloud,gm,ga,ld,ps) in the environment filed.
 
If the user selects search by account is "windows or email " then it should be visible (cloud,gm,ld,ps) in the environment field.
 
write catalog client script and ui policy.
 
Any idea above scenario help me.
1 REPLY 1

HrishabhKumar
Kilo Sage

Hi @Ram012 ,

For this you can write an onchange catalog client script on search_by_account variable. There you can use g_form.clearOptions and g_form.addOption to manipulate the options in environment variable dynamically.

Here is the script, you can use this logic:

 g_form.clearOptions('environment');

    if (newValue == 'account_owner') {
        // Add options for account owner
        g_form.addOption('environment', 'cloud', 'Cloud');
        g_form.addOption('environment', 'gm', 'GM');
        g_form.addOption('environment', 'ga', 'GA');
        g_form.addOption('environment', 'ld', 'LD');
        g_form.addOption('environment', 'ps', 'PS');
    } else if (newValue == 'windows' || newValue == 'email') {
        // Add options for windows or email
        g_form.addOption('environment', 'cloud', 'Cloud');
        g_form.addOption('environment', 'gm', 'GM');
        g_form.addOption('environment', 'ld', 'LD');
        g_form.addOption('environment', 'ps', 'PS');
    }

Feel free to customize this logic, and use correct variable and option names, and it should work.

 

Thanks,

Hope it helps.

Mark it helpful and Accept solution if it helps.