<@UECFF1JK1> restlets are a more appropriate type ...
# suitescript
s
@Lukas Astalos restlets are a more appropriate type of script for server or backend web service calls to be made, as they can be authenticated with OAuth. Suitelets can either be used with a valid user session (which is not available in a server script) or you’d have to make it available without login, but that compromises security. However, if the only thing you are trying to do is to get the code in a second user event to run when the first user event runs, you may have better options. If you have enough governance allowance left, you can import the second script as a module or library and call it directly (assuming the script are both 1.0 or 2.x, otherwise that won’t work as different versions can’t be mixed). Another approach would be to submit a scheduled script task from the first user event, and have it run the code in the second user event, or trigger that user event through normal record operations.
l
Thank you Scott. I already switched to Restlet and it works fine, I was just hoping to make the SL to work, too. The other options you are mentioning wouldn't work for my case, because the UE I want to trigger from SL comes from bundle, so I can't make a library from it. And the SL/RL approach was chosen to minimize the delay the scheduled script could bring.
s
i see. yes, if you want to do this synchronously, and minimize the delay, a restlet is very likely the best solution. I know some people have gotten suitelets to work for server-side calls, but there are many issues to overcome to make that work, so the restlet is going to be the simpler option overall.
👍 1