Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Pre-event handler and post-event handler

(0) ShareShare
ReportReport
Posted on by 150

I want to overwrite the clicked method of a standard form extension. I can only use event handlers. So do I use pre or post? 

How do you know when you use them?

  • PrachiGupta97 Profile Picture
    150 on at
    RE: Pre-event handler and post-event handler

    I need to write my custom code in active () method of a form extension datasource to disable and enable a button.

    But I cannot overridde it since it is a standard form extension. So which event handlers do I use?

  • Verified answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: Pre-event handler and post-event handler

    You can't override (replace) the standard method. OnClicking is executed before the super call of the clicked method, onClicked is executed after the super call. Pre-/post handlers are executed before/after the clicked method.

    Any code in the clicked method will be executed anyway.

    In clicked methods it's quite common to use post handler or onClicked event but it always depends on your scenario and functional requirement, which we don't know.

  • Blue Wang Profile Picture
    on at
    RE: Pre-event handler and post-event handler

    Hi PrachiGupta,

    The most common case where we use eventhandlers is when we want to execute any custom business logic prior/later to insert/update of table record or based on activity(on class) to trriger the event. Usage is that for new custom code, we can make use of event handlers without adding any code to the standard code(decoupling) and thereby more organized by placing/grouping code in one class.

    More details ,please refer this thread:

    community.dynamics.com/.../694300

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,034 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans