can anyone explain what is synchronous aynchronous...
# suitescript
v
can anyone explain what is synchronous aynchronous in suitescript?
s
Synchronous waits for each line to complete. Asynchronous won't block, but will continue to process. Example: For synchronous, if 2 API calls take 30 seconds, then the execution time will take a minute, because the 2nd api call will not happen until the 1st api call returns. However with asynchronous, those 2 api calls will happen at the same time, thus reducing the execution time to 30 seconds.
v
Thankyou How to make the asynchronous to synchronous?
s
Here is an example from the help docs the .then is what happens once the https get call completes. The catch is for errors
Copy code
https.get.promise({
    url: '<https://www.testwebsite.com>',
    headers: headerObj
})
    .then(function(response){
        log.debug({
            title: 'Response',
            details: response
        });
    })
    .catch(function onRejected(reason) {
        log.debug({
            title: 'Invalid Get Request: ',
            details: reason
        });
    })
v
Ok thank you So much
could you please share me the link of the help docs?
s
sure! also, login to netsuite --> Help (top right) --> type in your module like N/https in the search bar
<https://{your%20account}.app.netsuite.com/app/help/helpcenter.nl?fid=section_4619547935.html|https://{your account}.app.netsuite.com/app/help/helpcenter.nl?fid=section_4619547935.html>
v
Thank you