Hi all, Can I call a Suitelet from a User Event sc...
# suitescript
m
Hi all, Can I call a Suitelet from a User Event script in Promise mode so that the UE script doesn't wait for the SL to finish at all? Will it let the UE script finish before the SL execution is done?
b
No, the user event will wait for the request to finish
👍 1
j
@battk Didn't he say promise mode? Aren't we able to run async processes in server scripts?
b
a promise that takes 10 seconds to resolve will still add 10 seconds to the save time of the record
the script will still wait for all promises it started to finish
j
Okay. But wouldn't the code written after promise start to execute, while the async process is happening?
b
yes
j
Ah, it makes sense. Thanks @battk. One more question, it's said that 2.1 supports server side promises. Are we referring to standard javascript promises or suitescript promises?
b
im unsure of any difference between a suitescript and javascript promise
j
Suitescript gives us record.create.promise, search.create.promise and such stuff. I was wondering whether we could use that in serverscripts.
b
You can
m
I've tested this btw and @battk was right. That is - partially. Let's say the suitelet will run for 2 minutes. The UE calling the suitelet will receive a time out within 15 seconds, will go to catch because of it (at the end of the script) and exit. The SL will still continue running. It will however still hold the UE execution for the timeout period.