How to call a suitelet from userevent script witho...
# ask-stanley-ai
j
How to call a suitelet from userevent script without waiting for the response?
c
AI generated answer (using internal Slack threads):
To call a Suitelet from a UserEvent script without waiting for the response, you would typically use the HTTPS module in SuiteScript 2.0. However, it's important to note that this approach will not work if the Suitelet is not public (i.e., it requires login). In such cases, you would need to either make your Suitelet public or use your Suitelet script in a UserEvent as an import library and invoke it. Please be aware that making a Suitelet public has security implications and should be done with caution. Here's a general example of how you might call a Suitelet from a UserEvent script:
Copy code
javascript
var url = urlModule.resolveScript({
    scriptId: 'customscript_my_suitelet',
    deploymentId: 'customdeploy_my_suitelet',
    returnExternalUrl: true
});

var headers = {
    'Content-Type': 'application/json'
};

var response = <http://https.post|https.post>({
    url: url,
    headers: headers,
    body: JSON.stringify(myData)
});
However, this will wait for the response. If you want to make the call without waiting for the response, you would need to use a different approach, such as using a Scheduled Script or Map/Reduce script to make the call asynchronously. Please note that you cannot make the HTTPS request asynchronous in SuiteScript. If you need to perform an asynchronous operation, you might need to consider using a different script type or approach. ****** 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.852012336
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844207
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84339875
Please provide your feedback on this answer.