how can I call a suitelet from a user event withou...
# ask-stanley-ai
r
how can I call a suitelet from a user event without a client script?
c
AI generated answer (using internal Slack threads):
To call a Suitelet from a User Event script without a Client script, you can use the HTTPS module in SuiteScript 2.0. However, there are a few things to consider: 1. If the Suitelet is not public (i.e., it requires login), you will not be able to call it directly from a User Event script. This is because Suitelets require a valid JSESSIONID cookie, which is only available when a user is logged in. 2. If you still want to call a non-public Suitelet from a User Event script, you would need to find a way to get the JSESSIONID cookie from the current user and send it to the Suitelet. However, this approach is not recommended due to potential security risks. 3. An alternative approach is to make your Suitelet public, which means it can be called without a login. However, you should carefully consider the security implications of this approach. 4. Another option is to use your Suitelet script in a User Event as an import library and invoke it. Here is a general example of how you can call a Suitelet from a User Event script using the HTTPS module:
Copy code
javascript
var url = urlModule.resolveScript({
    scriptId: 'customscript_my_suitelet',
    deploymentId: 'customdeploy_my_suitelet',
    returnExternalUrl: true
});

var response = httpsModule.get({
    url: url
});
Please replace 'customscript_my_suitelet' and 'customdeploy_my_suitelet' with your actual Suitelet script ID and deployment ID. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859303534
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855184138
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854616344
Please provide your feedback on this answer.