Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

How to catch Cancel Event?

(0) ShareShare
ReportReport
Posted on by 47

Hi

I have a custom screen i Dynamics SL where I customize it in Visual Studio

I would please like to find out if there is a way to catch the cancel event of the built in message screen. For instance when I create a batch it pops up a screen showing the batch being created with a cancel button on it and later also shows when the batch has been created successfully. I am trying to achieve a sort of a roll back action, sometime when a user cancels the batch creation there is uncompleted entries in the database so I would like to catch that event of that cancel button so I can try and write code to prevent redundant data. 

Please Advise 

Regards, Lee'Roy Gerber

*This post is locked for comments

  • Apps Mexico Profile Picture
    1,090 on at
    RE: How to catch Cancel Event?

    Maybe, if you use the Call Tranbeg(true), tranend() and tranabort functions, you could achive that. But I preferd do that kind of process on a store procedure and handle the transactions on it.

    If you couln't fix that and are interested i have many store procedures to create any kind of batches, and could give you a quote of a process that you need.

  • FATSN00 Profile Picture
    47 on at
    RE: How to catch Cancel Event?

    Hi Juan

    Thanks for the reply! I have another question for you in connection with this. We have a custom exe in Dynamics SL which creates a batch. Upon clicking the begin processing button it starts to create the batch in the db. Our problem is sometimes half way through the batch creating process you can get that a user pushes the cancel button the message box cause a uncompleted batch to be written to the db and will thus not balance. Is there or do you know of a way where I can apply a sort of roll back action which rolls back the batch creation or deletes the uncompleted batch data within the db when clicking the cancel button?

    Please advise me on this thank you

    Regards,

    Lee'Roy

  • Suggested answer
    Apps Mexico Profile Picture
    1,090 on at
    RE: How to catch Cancel Event?

    Hi,

    The event that trigger when you press the cancel button or the ESC key is 

    Private Sub Update1_CancelEvent(ByVal Level As Short, ByRef RetVal As Short) Handles Update1.CancelEvent

    End Sub

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans