Nour Khaled
01/28/2025, 2:00 PMCeligo AI
01/28/2025, 2:00 PMAI generated answer (using internal Slack threads):To call a Restlet from another Restlet in SuiteScript 2.0, you can use the
N/https module's requestRestlet method. This method automatically handles authentication for you when making the call within the same account.
Here is a sample code snippet:
javascript
var restletUrl = url.resolveScript({
scriptId: 'customscript_ad_rl_query',
deploymentId: 'customdeploy_ad_rl_query',
returnExternalUrl: false
});
var response = https.requestRestlet({
url: restletUrl,
body: context.request.body
});
In the above code, url.resolveScript is used to get the internal URL of the Restlet you want to call. The scriptId and deploymentId are the identifiers of the Restlet. The returnExternalUrl parameter is set to false to get the internal URL.
Then, https.requestRestlet is used to make the call to the Restlet. The url parameter is the URL of the Restlet and the body parameter is the request body.
Please note that this method only works when making the call within the same account. If you are making the call from a different account, you will need to handle authentication manually.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
01/28/2025, 2:01 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842710853
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837854862
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836999
Celigo AI
01/28/2025, 2:01 PM