There are a few reasons why you may want your SuiteCommerce site to wait for data from NetSuite before a page loads, including:
There are two methods to make the site wait for your data.
It is often the case that you want to wait for certain data to be fetched from NetSuite before anything loads. The site natively does this with things like the environment object and user object. Adding this to your extension is quite easy.
In your JavaScript entry point, you simply need to add a Promise object to the “container”. This is done using the code below:
or
The basics are as follows:
Step 1: Define some Promise object
Step 2: Either a generic one (jQuerry.Deferred()) or one based on a Backbone model call (i.e, “model.save”).
Step 3: Add that promise to the “container” object using the “waitForPromise" function.
Step 4: Resolve that promise when you need to.
The site will always wait for the promise to resolve to finish loading.
It is often the case that you want to wait for certain data to be fetched from NetSuite before loading a page. Similar to above, this is quite easy.
The view rending on the page MUST have been created using the “registerPageType" function of the “PageType” component.
These views have a native function called “beforeShowContent". This function MUST return a Promise object. The view will wait for the promise to resolve before rendering.
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!
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!
We are a premium SuiteCommerce agency that creates powerful customer portals. Unlike our competitors, we have already solved your problems.
Tagged with Training