Hi all. Can someone tell me how to catch the user ...
# suiteflow
j
Hi all. Can someone tell me how to catch the user action "Close Order" and display an "Are you Sure" message? I see the confirm workflow action , I'm just not sure how to set the condition to trigger it. The "Close Order" action was a button, but I have moved it to the Action Menu. Thanks!
m
This would be difficult without scripting as you need to capture a user response from the pop up window The only option a workflow provides for this is the confirm action It would not be the ideal process but this would accomplish your goal 1. Hide the native close order button/action 2. Add a custom field to the order called “close order” (this can be a checkbox) 3. Add the confirm action using the before user submit trigger 4. Then add a transition to a new state when “close order = T 5. 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
Alternatively you could remove the native close button/action and use a user event script to add your own close order button Then 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 is a better user experience but would require scripting
j
@MGBC Thanks for the detailed response! My assumption in this case with the confirm window was that Ok would return True and close the order, No would return false and do nothing. I have removed the "Close Order" button, so the action is only available from the pulldown action menu. The biggest problem we are having is users accidentally hitting the "Close" button, so just this change solves the problem 95% of the time. I like option 2 better and i have no issues creating the simple script for this. thanks again for you insight...
k
V. Are you sure? M. I am positive! My Cousin Vinny LOL could not resist 🙂
j
@JR - late to the party here... my hack with using suiteflow + DOM manipulation with an inlineHTML field; add a beforeload into the WF, set the inlineHTML field to be something like:
Copy code
document.getElementById('closeremaining').onclick=function(event){  
let confTxt= "Do you really want to cancel???";
  if (confirm(confTxt) == true) {
    close_remaining(nlapiGetRecordId(),'purchord')
  }
}
Not a supported approach, but simple enough and effective enough