Depending on the field, another field is Mandatory and Visible.

karishma shaik
Tera Contributor

Hi Team,

I need to get some code as per the requirement,

1) I had a choice field in custom table which had 3 choices in the choice field X,Y,Z. so when ever I select X or Y from the "Choice Field" then the "Text Field" should be appeared and when ever I select Z from the "Choice Field" then the "Text Field" should be disappeared.

2) I had a reference field with auto updated user and when we impersonate with that user, the "Text Field" should be mandatory also there will be a check box field and if the "Check Box" field is checked then the "Text Field" should be disappeared until the ticket is closed.

Please help me on this .

Thanks,

Karishma.

14 REPLIES 14

Mark Manders
Mega Patron

I assume you know how UI policies work? If not: check here.

If my answer helped you in any way, please then mark it as helpful. If it resolved the issue, please mark it as correct.

Mark


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi Mark Manders,

Please send the code for the requirement.

Thanks,

Karishma.

Satanik1
Giga Guru

Hi Karishma,

Write a UI Policy like this: 

find_real_file.png

Please mark helpful / correct if my answer helps to move further or resolves your issue.

Thanks,

Satanik

 

Hi Satanik,

I have written the on-change client script, but there is no luck.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

  
    var payment = g_form.getValue('u_payment_method_verified');
    if (isLoading) {

        if ((pm == 'u_ach' || pm == 'u_wired') && (g_form.getValue('u_cost_accountant') == g_user.userID )) {

            g_form.setVisible('u_if_not_why', true);
            g_form.setMandatory('u_if_not_why', true);

     } else {

           g_form.setMandatory('u_if_not_why', false);
           g_form.setVisible('u_if_not_why', false);

       }
    } else {
        if ((pm == 'u_ach' || pm == 'u_wired') && (g_form.getValue('u_cost_accountant') == g_user.userID )) {
            g_form.setVisible('u_if_not_why', true);
            g_form.setMandatory('u_if_not_why', true);


        } else {
            g_form.setMandatory('u_if_not_why', false);
            g_form.setVisible('u_if_not_why', false);

        }
    }
    }