I want to do a confirm dialog box on Purchase orde...
# ask-stanley-ai
t
I want to do a confirm dialog box on Purchase order close, when close button is pressed. If Cancel is clicked on that, don’t close the order, if okay, close the order
c
AI generated answer (using internal Slack threads):
Based on the conversations, there are two main approaches to implement a confirm dialog box on Purchase Order close: 1. Using SuiteFlow: - Hide the native close order button/action. - Add a custom field to the order called “close order” (this can be a checkbox). - Add the confirm action using the before user submit trigger. - Then add a transition to a new state when “close order = T. - 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 order, mark the Close Order checkbox and click save. - Upon save a pop up will appear asking “are you sure you want to close this order?”. - 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 SuiteScript: - Remove the native close button/action and use a user event script to add your own close order 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. - This approach provides a better user experience but would require scripting. Here is a sample code snippet for the second approach:
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')
  }
}
****** 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.844191432
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82071
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.815907657
Please provide your feedback on this answer.