Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
In Client scripts, setvisible() or setDisplay() is not honored when used along with setmandatory() - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • In Client scripts, setvisible() or setDisplay() is not honored when used along with setmandatory()
KB0697413

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


1020 Views Last updated : Jan 28, 2024 public Copy Permalink
KB Summary by Now Assist

Issue

Symptoms


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

Release

Istanbul, Jakarta, Kingston, London 

Cause


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.

Resolution


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.

 


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.