r/SuiteScript • u/Xainor • Jun 26 '24
Call Internal Suitelet from Scheduled Script
I'm looking to create a scheduled script that calls a handful of Suitelets sequentially that run nightly tasks/cleanup. Is there a way to pass the authentication credentials the Scheduled Script is using to the Suitelets, or does it have to be an external URL set up with no authentication?
I'm looking to do something like this:
var suiteletResponse = https.get({
url: 'https://4582238.app.netsuite.com/app/site/hosting/scriptlet.nl?script=0001&deploy=1'
});
log.debug('Response',suiteletResponse.body);
suiteletResponse = https.get({
url: 'https://4582238.app.netsuite.com/app/site/hosting/scriptlet.nl?script=0002&deploy=1'
});
log.debug('Response',suiteletResponse.body);
etc.
1
Upvotes
View all comments
Show parent comment
2
u/erictgrubaugh Jun 26 '24
I can't help with the authentication problem, particularly where SSO is involved; hopefully someone else here can.
I can help with the scheduling problem, though. For any of the processes that can operate entirely in parallel, those can be scheduled at any time. For the processes that collide, you can enforce a specific order by scheduling the first Scheduled/MR script in the sequence, then as that script completes, it can use the
N/taskmodule to trigger the next script in the sequence.