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.
setMandatory in catalog client script on List Collector is throwing console error blocking the remaining script from executing - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • setMandatory in catalog client script on List Collector is throwing console error blocking the remaining script from executing
KB0679500

setMandatory in catalog client script on List Collector is throwing console error blocking the remaining script from executing


2704 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

Description

setMandatory in Catalog Client Script throws the console error Uncaught TypeError: Cannot read property 'querySelectorAll' on List Collector and blocks the remaining script from executing.

Steps to Reproduce

 

  1. Create a record producer on table User (sys_user).

  2. Create two variables:

    • A variable of type List Collector mapping to First name in the sys_user table
    • A variable of type Select Box with question choices (Yes : 1, No: 0)
  3. Create an OnChange catalog client script on the second variable.

    function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
    return;
    }
    if(newValue == '1') {
    g_form.setMandatory('first_name',true);
    alert('set to true');
    }
    else {
    g_form.setMandatory('first_name',false);
    alert('set to false');
    }
    }
  4. Go to the record producer and click Try It.

  5. Change the values in the second variable from Yes to No and vice versa.

    You see an error in the console whenever the onChange client script is run. Because of the script error, the next lines of code are not executed and the alert never comes up. For example:

    https://<your-instance>.service-now.com/nav_to.do?uri=/com.glideapp.servicecatalog_cat_item_view.do%3Fv%3D1%26sysparm_id%3D19a1b35ddb520300b84ffd131d961919

 

Workaround

Add a True/False type property named glide.sc.use_sc_form_v2 and set the value to false.

If you are able to upgrade, review the Fixed In field to determine whether any versions have a permanent fix.


Related Problem: PRB1238021

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.