By adamb - 4/6/2007
Morning, all. Just a quick question about the use of the BeforeDelete event for business objects.
I'm using the standard delete button as provided by the MaintenanceFormToolStrip, which triggers the BeforeDelete event of my primary business object. What I need to happen in the event is this: If the user confirms the delete by choosing "yes" from the dialog that comes up, functions in other business objects must first occur, and then the deletion in the main business object happens.
My trouble is the fact that those functions in other business objects are called no matter what before dialog comes up, so even if the user clicks "no", the functions have been run. I was under the impression that the BeforeDelete event would be triggered only when the user confirmed the deletion and not merely when the delete button was clicked. Is there a standard way to handle this?
Thanks in advance,
Adam
|
By Greg McGuffey - 4/6/2007
Adam,
I seem to recall that the confirmation happens after BeforeDelete...i.e. the sequence is:
BeforeDelete (which you can cancel)
SF Confirmation
Record deleted
AfterDelete
To check this, just add the BeforeDelete and AfterDelete event handlers, put a break in BeforeDelete and observe what happens.
Obvisously, the place to handle what you want is in the BeforeDelete, but you'd need to provide your own confirmation. Of course, you'd also need to turn off SF confirmation. I don't know how/if you can turn off the SF confirmation though.
|
By adamb - 4/6/2007
Greg,
I believe one can turn the deletion confirmation off, which I'll look into. If so, it solves my problem pretty easily. Thanks for the tip.
- Adam
|
By adamb - 4/6/2007
It looks like deletion confirmation can be turned off by changing the "AutoShowDeleteConfirmation" property in the form itself to false. Turning this off and providing my own confirmation solved the problem and now the functions in the secondary business objects only fires when the user confirms the deletion.
Thanks again!
|
By Greg McGuffey - 4/6/2007
Excellent.
|
By Trent L. Taylor - 4/6/2007
That was it We took Good Friday off, so I am just checking in, but it seems that you got it figured out. Thanks, Greg.
|
|