Can I trigger a suitelet in a user event aftersubm...
# suitescript
j
Can I trigger a suitelet in a user event aftersubmit without redirecting to said suitelet? Use case is that I'm trying to use a UE to trigger another UE with the suitelet as the in between. But I don't need users going to the suitelet. Want this to all be background stuff they don't even notice.
a
Yes, you would be able to do that by using the https module and doing a get or post request to that suitelet(the suitelet may need to be available without login).
j
Wonderful idea! Thank you!
I have only used https for external posting so I completely forgot I can post internally.
m
You can get the URL of the suitelet using
N/url
url.resolveScript
.
z
instead using SuiteLet, I suggest that you try Restlet
j
@Zoran R-DATAGRAM Any reason why you think that's a better way to do it? I just need the UE scripts to run on a newly created record (created by a UE) so I just need a suitelet that loads and saves. Is restlet better for that?
Sends an HTTPS request to a RESTlet and returns the response. Authentication headers are automatically added. The RESTlet will run with the same privileges as the calling script.
It is hard (not possible?) invite SuiteLET from server-side-scripts (UserEvents in your case), until you setup it with checked Available Without Login option (but in that case you open the door into your system for everyone from everywhere
Let’s say it is a best practice to use RestLet or SCHEDULED Task if you want to process additionally data related to UserEvent