The CreatorCon Call for Content is officially open! Get started here.

Why 'Leave Alone' - Visible property of UI Policy Action overwrites setDisplay(True/False) on client script for a field?

Pranshu3
Tera Expert

Hi all,

I have a client script onLoad to control display of a field based on GlideAJAX condition.
Also, there is a UI Policy Action controlling the 'Mandatory' feature of the same field, but Visible property is 'Leave Alone'.
Still, the setDisplay(True/False) doesn't have required affect.
So, does the UI Policy overwrite the client script even if selected 'Leave Alone'?
Then, how is 'Leave Alone' helpful at all??

1 ACCEPTED SOLUTION

Kristian Juul A
Kilo Expert

... and you can't hide the field if it is set to mandatory.

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Pranshu,

Client script runs first then UI policy will run at the end;

Leave Alone means do nothing based on the conditions

Leave Alone: Does not change anything about the visibility of the field (useful if different UI Policies can affect different properties of the field)

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Kristian Juul A
Kilo Expert

... and you can't hide the field if it is set to mandatory.

Pranshu3
Tera Expert

Thanks for the replies, due to mandatory fields, the hide action in client script was not working.