Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to execute code before command button (OK) press?

(0) ShareShare
ReportReport
Posted on by

Hi,

how can I execute my own code using extensions before a form command button press, if the command button does not have the clicked-method overridden/available in standard code?

I need to insert a couple of records into my own table before executing the OK in form.SalesQuotationEditLines.

If I subsrcibe to the OK_OnClicked event of the button, the actual OK action is done and my records are inserted after the button's super() call if I'm not mistaken. And there's not a pre event for the button.

*This post is locked for comments

  • AB2014 Profile Picture
    on at
    RE: How to execute code before command button (OK) press?

    Thank you for this.

  • Verified answer
    Martin Dráb Profile Picture
    233,454 Most Valuable Professional on at
    RE: How to execute code before command button (OK) press?

    The point of the OK command is closing the form. If you want to execute some code when a form is closing, subscribe to its OnClosing event.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans