Disclaimer: Always perform any tests such as this in your Sandbox account. If your company does not have a Sandbox account, then you must be aware of the risks associated in this exercise. It is also highly recommended that you obtain a Sandbox account so you can safely conduct such tests.
You might have encountered a strange error while working on your NetSuite account.
And you had no idea why that’s happening.
Sample of these errors are:
- ReferenceError pageInit is not defined
- An unexpected error has occurred
- TypeError: Cannot read property “custbody_field” of null
- “Please choose an item to add”
- JS_EXCEPTION TypeError undefined is not a function
- “You must enter at least one line item for this transaction.”
Another type of issue is when a strange behavior happens when you’re viewing of saving. You could be setting a field but upon saving, the field gets cleared out. For example, you’re setting the ‘paymenthold’ field to true on the Vendor Bill but upon saving, it always gets set to false.
If you’ve tried every basic troubleshooting steps like restarting the browser, clearing cache and cookies or trying a different browser, then most probably the error is caused by a script deployed on that record.
You may find it scary if you haven’t written a single line of code before. Don’t worry, in this guide, there is no need to read any code in your NetSuite account.
To find the NetSuite script that is causing the error, follow these steps:
- Go to Customization > Scripting > Scripted Records.
- Edit the record that you’re trying to troubleshoot, say for example, “Sales Order”.
- Look at the list of scripts deployed on the record defined by the “Deployed” checkbox.
- Uncheck all the scripts under “User Event Scripts” or “Client Scripts”.
- Go back to the form you are working on and try to replicate the error.
- The error/issue will most likely stop after doing the previous step. To isolate the exact script that is causing the problem, tick the checkbox beside the script one by one. Take note of the last script that you enabled.
- Try to replicate the error again by going to the form. If the error/issue starts to happen again, then it means you found the offending script.
Client scripts only get triggered when the form is on “Edit” or “Create” mode, so you can just focus on the Client Script and skip the User Event Script if the problem happens in this mode.
If unchecking all scripts under “Client Scripts” and “User Event Scripts” did not prevent the issue from occurring, then try looking at Custom Forms and Workflows tab to see if one of them is the culprit.
Another reason could be a custom field that has incorrect formulas or Sourcing & filtering settings. Review if there are any custom fields on your transaction record that might have been misconfigured.
LEACC Consulting is a team of NetSuite Certified Developers with IT experience solely dedicated to NetSuite technologies for eight years. We are experts in both SuiteScript 2.0 and SuiteScript 1.0. Our team has worked with 400+ NetSuite scripts and workflows combined.
Do you have NetSuite Development needs? Do you need help with a solution like this? Click on the link below and let’s have a chat about your project requirements!