Boban Dragojlovic
06/11/2025, 8:50 PMCeligo AI
06/11/2025, 8:50 PMAI generated answer (using internal Slack threads):In NetSuite, there isn't a direct way to check if a user is authenticated or not in an anonymous Suitelet. However, there is a workaround that you can use. You can try to access the internal URL of the Suitelet. If the user is logged in, they will be able to access the Suitelet's content. If they are not logged in, they will be redirected to a login screen. Here's a simple example of how you might implement this:
javascript
function onRequest(context) {
if (context.request.method === 'GET') {
var url = urlModule.resolveScript({
scriptId: 'customscript_my_script',
deploymentId: 'customdeploy_my_deployment',
returnExternalUrl: false
});
context.response.write('<iframe src="' + url + '"></iframe>');
}
}
In this example, customscript_my_script
and customdeploy_my_deployment
should be replaced with the script ID and deployment ID of your Suitelet. The iframe will either display the Suitelet's content (if the user is logged in) or a login screen (if the user is not logged in).
Please note that this method is not foolproof and may not work in all situations. For example, it may not work if the Suitelet and the page that's checking the login status are not on the same domain due to CORS restrictions.
******
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
06/11/2025, 8:51 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803222179
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.793872416
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.792523623
Celigo AI
06/11/2025, 8:51 PM