field.changed not working for SOW in UI policy

priyankapalaska
Giga Contributor
I have a requirement, if change coordinator and manager are same , throw and error msg to specific changed field and clear the field.
to do low code, i have written only one UI policy and set condition if "coordinator is same as manager" and running script below:
 var coordinator = g_form.getControl('u_change_co_ordinator1');
    var manager = g_form.getControl('requested_by');
 
    if ( coordinator.changed && g_form.getValue('u_change_co_ordinator1')!="") {
        g_form.setValue("u_change_co_ordinator1", "");
        g_form.showFieldMsg('u_change_co_ordinator1', "Approving manager and change coordinator must be different", "error");
    } else if (manager.changed  && g_form.getValue('requested_by')!="") {
        g_form.setValue("requested_by", "");
        g_form.showFieldMsg('requested_by', "Approving manager and change coordinator must be different", "error");
    }
 
this is running fine in default view but not running on SOW view. 
If I remove manager.changed or coordinator.changed, it running but thats not fulfilling the requirement. 
 
Any suggestion. 
Quick response will be appreciated.
1 REPLY 1

Anirudh Pathak
Mega Sage