Category : NetSuite ERP
When using promises in your SuiteScript scripts to implement asynchronous programming, you should consider the following best practices.
If you are using SuiteScript 2.1 scripts, consider using the async and await keywords to implement asynchronous solutions instead of using the promise keyword.
Best practices for coding promises:
async/await functionality.promise.finally if you have code that should run regardless of the outcome of the promise.promise.all for multiple unrelated asynchronous calls.promise.then calls. Instead, use promise.catch.promise.spread.promise.map.promise.then to run code after the promise completes.Best practices when using async and await keywords:
async/await.return await.async and await keywords: N/http, N/https, N/llm, N/query, N/search, and N/transaction.Tags: