Determine if there are client-side script errors



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



  • Field removed from 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

  • 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. 



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;

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, take the following steps: 

(This example 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 directly 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 Java script that failed and you see the failing line directly above a red highlighted error as shown below: 
  8. In looking at the script you look at 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 clients script search where the script contains the offending text. In this case, the client script filter would look like:
    script contains myMessage

Article Information

Last Updated:2019-08-02 21:29:02