Why does my suitelet return a login page as response?

I have a workflow action script that should call a suitelet and fetch response. The suitelet should actually return some custom html code, but instead it returns me Netsuite Login Page as a response.

Call from workflow action script:

/**
* @NApiVersion 2.1
* @NScriptType WorkflowActionScript
*/
define(['N/redirect','N/ui/dialog','N/http','N/url','N/runtime'],

(redirect,dialog,http,url,runtime) => {
const onAction = (scriptContext) => {
var domain = url.resolveDomain({
hostType: url.HostType.APPLICATION
});
var scriptURL = url.resolveScript({
scriptId: 'customscriptor_st_triggersuitelet',
deploymentId: 'customdeployor_st_triggersuitelet',
returnExternalURL: true
});
var results=http.get({
url: "http://" +domain+scriptURL
})
log.debug("Result is",results);
}
return {onAction};
});
My suitelet code:

/**
 * @NApiVersion 2.1
 * @NScriptType Suitelet
 */
define(['N/ui/serverWidget','N/runtime','N/ui/dialog'],
    
    (serverWidget,runtime,dialog) => {
        const onRequest = (scriptContext) => {
            var html = '<html>' +
                '<body>something:  <br/>'
                +'<form method="post">' +
                ' Input ' +
                '<input type="text" name="something" id="something" value=""/> ' +
                '<input type="submit"/> ' +
                '</form></body></html>';
            scriptContext.response.write(html);
        }
        return {onRequest}
    });

The response l receive from the suitelet :

<!doctype html>\n\n<html>\n<head>\n\t<title>NetSuite Login</title>\n\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n> ....(contd)
Any idea on what is the issue?
Rookie Asked on November 2, 2021 in How To's.
Add Comment
1 Answer(s)

Make sure to check the AVAILABLE WITHOUT LOGIN and  the Audience tab on your Script Deployment.

Rookie Answered on November 5, 2021.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor