Wait for one/many promesses to be fulfilled

Answered

Hey,

 

While continuing my SuiteScript training, I noticed that there is no way to “wait” for one/many promises to be fulfilled.

ex :

Wait for one/many promesses to be fulfilled

How could I wait for the result of “doSomething()” before returning true or false ?

 

I know how to do that in plain Javascript (use the await statement) but when I try to use it in my ClientScript, NetSuite tells me that there is an error in my file (at upload).

 

Any help would be nice 🙂 You can notice that I am very new to Netsuite so this might seems stupid, but I found nothing on SuiteAnswer that could answer my question.

 

Regards,

Loïc

Rookie Asked on November 28, 2019 in SuiteCloud.
Add Comment
1 Answer(s)
Best answer

I don’t think async/await would help you here. The function using validateField does not use async/await and would not wait.

Consider just returning false in doSomething. Then set the field back to whatever value was submitted, at the end of your promise chain (use ignoreFieldChange to ignore client script while doing so)

Advanced Answered on November 29, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor