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.
Setting a field to be non-mandatory with g_form.setMandatory makes the field mandatory - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • Setting a field to be non-mandatory with g_form.setMandatory makes the field mandatory
KB0597989

Setting a field to be non-mandatory with g_form.setMandatory makes the field mandatory


9794 Views Last updated : Oct 16, 2023 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Description

When client script is used to make a field not mandatory, the field is instead made mandatory.

Steps to Reproduce

  1. Create a client script to make the Short Description field of a change request NOT mandatory.
    An example client script is attached to this article.
  2. Open a change request record.
    Note that the Short Description field does not appear to be mandatory.
  3. Clear the Short Description field and try to save the record.
    A warning is displayed stating that the short description is mandatory and the record cannot be saved. 

Workaround

Work around the issue by setting your script to use a boolean argument rather than a string:

Before: g_form.setMandatory(field, 'false')

After: g_form.setMandatory(field, false);


Related Problem: PRB706263

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?

Attachments

Attachments

  • sys_script_client_cf58d481131da6006909b9b76144b027.xml

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.