Usman Bako
08/16/2024, 5:01 PMCeligo AI
08/16/2024, 5:01 PMAI generated answer (using internal Slack threads):To simulate a button click in a workflow, you can create a workflow action script that is triggered in the aftersubmit event and uses the N/redirect module to redirect to your suitelet. Here is a sample code snippet:
javascript
/**
* @NApiVersion 2.1
* @NScriptType workflowactionscript
*/
define(['N/redirect'],
function(redirect) {
function onAction(context) {
log.debug('context',context)
redirect.toSuitelet({
deploymentId: 'customdeploy_depl_id',
scriptId: 'customscript_script_id',
parameters: {
test: 19
}
})
}
return {
onAction : onAction
};
});
In this example, the onAction
function is triggered when the workflow action is executed. It uses the redirect.toSuitelet
method to redirect to a suitelet specified by its script ID and deployment ID. You can also pass parameters to the suitelet.
Please note that the workflow history might not log the completion of the transition to the next state, possibly because the script redirects before it can complete.
******
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
08/16/2024, 5:02 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833969951
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821755886
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821517587
Celigo AI
08/16/2024, 5:02 PM