Ganapathi H
Ganapathi H

Reputation: 21

How do we call Suitelet from RESTlet by using SuiteScript 2.0

Can anybody explain How do we call Suiteletfrom RESTlet?

The Code Snippet is:

serverResponse.sendredirect({
type: 'SUITLET',
identifier: 'customscript_sample_rl_cals_sl',
id: 'customdeploy_sample_rl_cals_sl'
});

But I am not able to find out the serverResponse in RESTlet while using https module, can anyone help on this?

Upvotes: 0

Views: 2200

Answers (1)

Adolfo Garza
Adolfo Garza

Reputation: 3029

Here's how to call a Suitelet within a RESTlet. Your Suitelet must be available without login. In this example the https module variable is referred as HTTPSMODULE:

var myRequest = {};
myRequest.headers = {};
myRequest.headers["User-Agent"] = "Mozilla/5.0";
myRequest.url = 'https://XXXXXXXXX'; //Suitelet External URL
var myResponse = HTTPSMODULE.get(myRequest);

Upvotes: 3

Related Questions