Notifications

1330 views

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

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-07-19 02:19:47
Published:2018-03-01