Not able to save business rule

Saroj Patel
Tera Expert

SarojPatel_0-1705298762382.png

Error MessageonSubmit script error: TypeError: Cannot read properties of undefined (reading 'replace'):
function onTemplateFieldSubmit() {
      var allowMultipleCarets = false;
      var CaretValidationError = function(message) {
       this.message = message;
      };
      var validationFunc = function(stringVal) {
       if(stringVal.match(/\^\^/))
        throw new CaretValidationError(getMessage("Your template contains an invalid character sequence: multiple carets"));
      };

      try {
       var cfilter = getFilter(fname, true, allowMultipleCarets ? null : validationFunc);
      } catch (err) {
       if (err instanceof CaretValidationError) {
        g_form.addInfoMessage(err.message);
        return false;
       }
      }

                     cfilter = cfilter.replace(/\^NQ/g, "^");
                     hinput.value = decodeURIComponent(cfilter);
      CustomEvent.fire("sys_mapping:on_cond_submit::" + fname, { value: hinput.value, ref: fname });
                 }


This error I'm getting

10 REPLIES 10

Guru raj1
ServiceNow Employee
ServiceNow Employee

We usually see this kind of errors on a specific tables when there are invalid characters in the dictionary of that table. Especially in the column label of the columns in dictionary related to those tables.