Contact Us

If you would like to notify a user of an error using the SuiteScript error page, you can use N/error to create your own error message. Import N/error, and then use it as such by following this code example:

throw error.create({
 name: "RECORD_IS_LOCKED",
 message: "Billing schedule has already been generated for this sales order. Please close this sales order and create a new one."
});
NetSuite Locked Record Error Message

Some Caveats about the Usage of ‘throw’ and N/error

If you throw an error, the remainder of the code will not be executed. If the error is thrown within a try/catch block, execution will jump to the catch component, and the error being thrown will be passed into the catch function.

As N/error errors are treated just as any other SuiteScript errors, an e-mail notifying an error has occurred will be sent to the users designated in the Unhandled Errors tab of the script. This action may be disabled by passing notifyOff: true in the error creation object.

This particular way of showing an error to the user does not create a particularly pleasing user experience compared to using NetSuite’s notification UI. The latter option would require the creation of a client script that needs to execute before saving the record is attempted, but N/error can be used without the need for an additional client script.


Got stuck on a step in this article?

We like to update our blogs and articles to make sure they help resolve any troubleshooting difficulties you are having. Sometimes, there is a related feature to enable or a field to fill out that we miss during the instructions. If this article didn't resolve the issue, please use the chat and let us know so that we can update this article!

Oracle NetSuite Alliance Partner & Commerce Partner

If you have general questions about SuiteCommerce or more specific questions about how our team can support your business as you implement NetSuite or SuiteCommerce, feel free to contact us anytime. Anchor Group is a certified Oracle NetSuite Alliance Partner and Commerce Partner equipped to handle all kinds of NetSuite and SuiteCommerce projects, large or small!

Horizontal Anchor Group logo orange anchor icon navy Anchor Group text

Tagged with Training