The typical OK button that would close the form and pass the “1111” code in the BPM is hidden, and I created the Submit button to replace it. When clicked, this button checks all of the date fields to make sure the same date hasn’t been selected. The user is prompted if any dates match. If there are no duplicated dates, then the form should pass the “1111” code to the BPM and close, but instead acts like the user clicked the close (X) button and gives the message that the user canceled the operation. How can I pass an OK code to the BPM so it can continue its process?
I have tried assigning “1111” to the button value…
Thanks @ckrusen, I didn’t think of that route. I did, however, with the aid of another, find a solution that I believe works. I’ll post the code in the next reply. Thanks again!
Thanks to @Rick_Bird, who guided me in the right direction. Since you can’t create a method for the single button you are required to have in a BPM Data Form, I ended up hiding that button and placing a new one on the form to handle all of the checks required before continuing on in the BPM. But it seems that the BPM Data Form looks for the click of that one required button, and anything else is viewed as a cancel. In the new method for the new button I have all of the checks and balances, and if everything is okay to proceed it then processes the code below to close out the form and continue with the BPM.
You would have had one issue to overcome, that I don’t know how to do off the top of my head. That would be to stop the form from closing, when those date conditions aren’t met.
From I’ve been told, adding an event handler does just that. It adds to handler, and doesn’t replace it.
The following code uses the += to add an event handler to the existing object:
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
Had it used "=" , then it would have probably replaced any existing event handlers. That might also cause an issue when the native disposal "-="is called and there isn’t a matching eventhandler in the object.
And while it’s just a guess, I believe the event handlers fire in order they were added to the object. So any native event handler would fire first, and then the one you added.
Update I added your code to the MES Clock out button and Put a MessageBox.Show. It did exactly what you said, fired after the Existing Handler. Thanks great stuff!