Why is my client script not detecting a button cli...
# ask-stanley-ai
a
Why is my client script not detecting a button click in my workflow. I also used a workflow action script and it doesn't initiate either. Both I am trying to use to open up a suitelet on a button that was added by a workflow action on the current workflow state.
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. ****** Based on the conversations, it seems like you're having trouble triggering a Suitelet script when a button (added from a workflow) is clicked. Here are some steps you can follow: 1. Create a custom workflow action script. This script will be responsible for redirecting to the Suitelet. You can use the
N/redirect
module's
redirectTo
function in SuiteScript 2.0 to redirect to the Suitelet. Here's a sample code snippet:
Copy code
javascript
var redirect = require('N/redirect');
function onAction(context) {
    redirect.toSuitelet({
        scriptId: 'customscript_my_suitelet',
        deploymentId: 'customdeploy_my_suitelet'
    });
}
2. In your workflow, add this custom action. Set the transition for this action to be the button click. This means that when the button is clicked, this action (and thus the script) will be triggered. 3. Make sure that the button is properly added in the 'Before Record Load' trigger of the workflow. If the button is not being detected, it might be due to the button not being properly added or the workflow not being properly triggered. Remember, the Suitelet must be deployed and the script ID and deployment ID in the
redirect.toSuitelet
function must match the Suitelet's actual script ID and deployment ID. If you've done all of this and the Suitelet is still not being triggered, it might be due to some other issue. You might want to check the script logs for any errors or unexpected behavior.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.861558497
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856273472
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.85456872
Please provide your feedback on this answer.