Debugging Scriptable Cart for SuiteCommerce or SCA
During development, you should open an incognito (private) session in your browser and then insert nlapiLogExecution
functions into your code to see the data as it is passed around. Including these nlapiLogExecution
functions makes it much easier to debug your script.
You should remove all the calls to log when you are finished debugging as they can have a negative impact on performance if triggered. However, you can leave them in for situations where you must have a log in case things go wrong.
If your script goes catastrophically wrong, these calls can trigger emails to you, a site administrator, or others in your organization. You can configure who receives notifications in the script record by going to the Unhandled Errors tab and selecting from the predefined options, or by specifying individual email addresses.
These settings only trigger notifications if there are unhandled exceptions that prevent the code from running normally. An example would be if your script included a call to a function called customPageInit
, but that function did not exist anywhere in the script.
To learn more about what happens when exceptions occur and notification are sent, see SuiteScript 1.0 Documentation.
When debugging, keep these issues and limitations in mind:
-
You cannot use SuiteScript 2.0 user event scripts and client scripts at the same time for Scriptable Cart. In most cases, it is better to use SuiteScript 1.0 for user event scripts and SuiteScript 2.0 for client event scripts; however, the reverse is also supported. For more information, see SuiteScript for Scriptable Cart.
-
Changes you make are not available in open sessions or browsers.