UI Plocy is not working

nameisnani
Mega Sage

 

Hi Team , 

 

 

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

nameisnani_0-1720596324358.png

 

 

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

nameisnani_1-1720596324355.png

 

 

 

I have created UI Policy for this ,

in the when to apply > CHANGES , option is not there .

nameisnani_4-1720596417476.png

 

 

 

But it is not working 

nameisnani_3-1720596324415.png

 

 

 

 

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

8 REPLIES 8

Vrushali  Kolte
Mega Sage

Hello @nameisnani ,

 

Can you please try using script option on UI policy with below script -

 

VrushaliKolte_0-1720598985318.png

function onCondition() {
 g_form.setMandatory('u_city', true); //replace variable name
 g_form.setMandatory('caused_by', true);
}

 

If my answer solves your issue, please mark it as Accepted and Helpful based on the impact.

Hi @Vrushali Kolte 

 

still form got saved 

 

nameisnani_2-1720601623643.png

nameisnani_3-1720601950310.png

nameisnani_4-1720601982412.png

nameisnani_5-1720602009042.png

@Vrushali Kolte @BillMartin @Satishkumar B @Sandeep Rajput 

 

PLease help me here 

nameisnani
Mega Sage

@Vrushali Kolte 

 

should i keep condtion and actions ? or remove 

nameisnani_0-1720601403923.png

 

Mark Manders
Mega Patron

Can you stop posting the same questions several times. People are giving you the same answers others have already given, without them knowing what you did or didn't try. You are not just wasting your own time and will loose track of the answers, but also of the people that are spending their own time to help you. 

If for any reason you want to post the exact same question again, because you aren't getting anywhere, close the previous one and add the already given (not working) solutions to the new question so there is a clear overview of what already was done.

https://www.servicenow.com/community/developer-forum/facing-issue-with-ui-policy/td-p/2985667

https://www.servicenow.com/community/developer-forum/ui-plocy-is-not-working/td-p/2985805

https://www.servicenow.com/community/developer-forum/1-ui-plocy-is-not-working/td-p/2987070


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