How to use a workflow to show a confirm action on ...
# ask-stanley-ai
j
How to use a workflow to show a confirm action on click of a custom button
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that you can't directly use a workflow to show a confirm action on click of a custom button because the confirm function is client-side, while workflow action scripts are server-side. However, there are a couple of workarounds you can use: 1. Using a custom field and a workflow: - Hide the native button/action you want to confirm. - Add a custom field to the record (this can be a checkbox). - Add a confirm action using the before user submit trigger in the workflow. - Then add a transition to a new state when the custom field is checked. - In the new state, add a Sublist action group for the items table. Add a set field value action to this group to set line.closed = T. - This way, the user will edit the record, mark the custom checkbox, and click save. Upon save, a pop-up will appear asking for confirmation. If they click Ok, the record will save and be closed. If they click cancel, the record will not save and remain in edit mode. 2. Using a user event script and a client script: - Remove the native button/action you want to confirm. - Use a user event script to add your own custom button. - When clicked, it would call a client script that triggered a pop-up message. The response from the pop-up message can dictate whether the script closes the order or not. 3. Using SuiteFlow and DOM manipulation with an inlineHTML field: - Add a beforeload into the workflow, set the inlineHTML field to be something like:
Copy code
javascript
   document.getElementById('closeremaining').onclick=function(event){  
   let confTxt= "Do you really want to cancel???";
     if (confirm(confTxt) == true) {
       close_remaining(nlapiGetRecordId(),'purchord')
     }
   }
- This approach is not officially supported, but it's simple and effective. ****** 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.864563
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.85760504
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.847961307
Please provide your feedback on this answer.