Check out Oracle NetSuite upcoming events and conferences here
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Update your Profile with your Support type to get your Support Type badge.
Expand your NetSuite knowledge by joining our Ask A Guru Live sessions. RSVP on this event now.
Don't miss out on our Question of the week! You only have until tomorrow, May 23, 2024, 2PM ET to comment your answers and earn rewards! Click here for more details.
Community Poll: What sort of content would you like to see more of?

Error When Conditionally Loading Custom Modules in SuiteScript

Hello everyone!

I am working to optimize the performance of User Event Scripts applied to transactions, written in SuiteScript 2.1. During my debugging, I discovered that significant delays occur when my script loads certain Custom Modules, which are also written in SuiteScript 2.1 and function as libraries. To enhance performance, I want to load these Custom Modules only when they are essential.

Here's how I tried to conditionally load the modules based on examples from other forums:

if (formScriptId === 'custform_test') {
   require(['../../path_to_lib/lib'], (lib) => {
     lib.beforeSubmit(context, formScriptId);


if (formScriptId === 'custform_test') {
  const lib = require('../../path_to_lib/lib');
  lib.beforeSubmit(context, formScriptId);

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!


Community Whiz

Quarter 2 ((Apr-Jun 2024) )

This Week's Leaders

This Month's Leaders

All Time Leaders