facing issue with Ui Policy

nameisnani
Mega Sage

Hi Team , 

 

 

under closure information ,  I have created 2 custom fields . please check screenshot .

nameisnani_0-1720591376318.png

 

when we click on ' COMPLETE' or States changes to ' closed ' these two custom become mandatory .

nameisnani_0-1720591647635.png

 

 

I have created UI Policy for this ,

nameisnani_1-1720591731599.png

 

But it is not working 

nameisnani_2-1720591794485.png

 

 

can anyone please help me here ... what was the mistake here . please provide steps .

 

.

 

8 REPLIES 8

Yashsvi
Kilo Sage

Hi @nameisnani,

Create Client Script:

(function executeRule(current, previous /*null when async*/) {
    if (current.state == 'Closed') {
        g_form.setMandatory('u_custom_field1', true);
        g_form.setMandatory('u_custom_field2', true);
    } else {
        g_form.setMandatory('u_custom_field1', false);
        g_form.setMandatory('u_custom_field2', false);
    }
})(current, previous);

Thank you, please make helpful if you accept the solution.

Samaksh Wani
Giga Sage
Giga Sage

Hello @nameisnani 

 

In Condition of UI Policy you have selected is, Instead of that pls select changes to.

 

Pls mark my solution as Accept, if you find it helpful.

 

Regards,

Samaksh Wani

nameisnani
Mega Sage

@Samaksh Wani In UI POlicy i don't see changes to option .

 

@Yashsvi  which cilent script i should wirte 

Hello @nameisnani 

 

In the Same UI policy, You will find one check Checkbox, On Load. Check it and then try.

Pls mark my solution as Accept, if you find it helpful.

 

Regards,

Samaksh Wani