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.
Determine if there are client-side script errors - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Determine if there are client-side script errors
KB0547069

Determine if there are client-side script errors


5048 Views Last updated : Aug 22, 2022 public Copy Permalink
KB Summary by Now Assist

Issue

The client script has errors, affecting the ability to set a UI policy to a form.

Symptoms

  • Field removed from the form
  • Cannot change field
  • Form is broken
  • UI policy not working
  • UI action not working
  • Client scripts not working
  • Form sections not loading
  • Fields not visible
  • Mandatory field not working

Cause

When client-side scripting is processed as a form is loading, any errors in the script can break all subsequent client-side processing. Since UI policies are processed after client scripts, this can break all UI policies. 

Resolution

Checking the browser console for client-side errors can be very helpful in diagnosing why UI policies are not working as expected. For this troubleshooting exercise, let's assume that an onload client script had been created for incidents called Test Script with the following code:

function onLoad() {
//Type appropriate comment here, and begin script below
var myMessage = test;
alert(myMessage);
}

In this case, the myMessage variable is not defined correctly, so it throws an error in the Java script window that causes client processing to fail, including UI scripts. To figure out this issue, follow the steps in the example below. This use case assumes that you are using the Chrome browser, but the other browsers have Java script consoles. The Chrome browser is easy to use for debugging this kind of problem and is recommended.

  1. Bring up the record that is not showing the UI policy changes you expect in Chrome.

  2. Go to Tools > Javascript console in the Chrome menu. It may be in different locations depending on the Chrome version, but usually clicking the wrench icon in the upper right corner gets you to this option.

  3. Right-click inside the console tab that opens and choose Clear Console so that you have a fresh start.



  4. Reload the record that is having the issue. You can use the Reload Form, located in the record header menu, or right-click on white space inside the record and choose Reload Frame from the Chrome menu.

  5. Check for any red messages in the console. In the example provided you would see the following:



  6. Click the link that is direct across from the red error. In this case, the link is incident.do:1313 in the screenshot.

  7. This takes you to the line of Javascript that failed and you see the failing line directly above a red highlighted error as shown below: 



  8. Looking at the script you can see the lines below the end of the current function and see:
    addRenderEventLogged(onLoad_75d0114d47e1750067638d90f70935ab, 'onLoad Test Script');function onLoad_b5d0114d47e1750067638d90f70935ab() {
  9. From this example, you can see that this was an onLoad script called Test Script.

  10. You can now go to that client script and correct any errors found there.

  11. If you are not able to find the script name in the script window (perhaps due to a really long script) then you can also do a client script search where the script contains the offending text. In this case, the client script filter would look like this:
    [script] [contains] [myMessage]

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.