need to call suitelet script inside userEvent scri...
# ask-stanley-ai
m
need to call suitelet script inside userEvent script
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To call a Suitelet script inside a User Event script, you can use the
url.resolveScript
method to generate the Suitelet URL and then use the
<http://https.post|https.post>
method to call the Suitelet. Here is a sample code snippet:
Copy code
javascript
var suiteletURL = url.resolveScript({
    scriptId: 'customscript_aby_ns_usaepay_process_cp',
    deploymentId: 'customdeploy_aby_ns_usaepay_proc_cp_dep',
    returnExternalUrl: true,
    parameters: {
        'custPymtId': custPymtId
    }
}); 
log.debug('DEBUG','suiteletURL: ' + suiteletURL);
var response = <http://https.post|https.post>({
    url: suiteletURL,
    body: 'MY DATA'
});
However, please note that this approach requires the Suitelet to be available without login, which might not be recommended due to security reasons. If you encounter issues with this approach, you might want to check the response body for any error messages. Alternatively, you can consider using the Suitelet's code as a custom module. This approach might be more secure and efficient, but it requires a different implementation. Please note that one User Event script cannot directly trigger another User Event script. If you need to trigger a User Event script on one record as a result of changes made from a User Event script on another record, you might need to use a workaround, such as calling a Suitelet from the first User Event script to trigger the creation/update of the second record.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.861080587
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.860969543
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.86084944
Please provide your feedback on this answer.
Thank you for your feedback