In Client scripts, setvisible() or setDisplay() is not honored when used along with setmandatory()



setVisible() and setDisplay() are working as expected but when these APIs used with setMandatory(), setVisible/setDisplay is not honored. 


Istanbul, Jakarta, Kingston, London 


From Istanbul onwards, we specifically and intentionally block setVisible or setDisplay calls on Mandatory fields to prevent scenarios where a field is mandatory, but not visible to be populated. This is designed functionality that is behaving as expected.


In order to display and make fields mandatory at the same time:

-- Use UI Policies instead of client script. Its also recommended using UI Policies over client script due some of the benefits check this doc: Use UI policy instead of a client script

-- If UI Policy is not helping you to achieve your functionality use setMandatory and setVisible in two separate client scripts.