Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Table - Method / Event...
Finance forum
Answered

Table - Method / Events in d365fo

Posted on by 5,885

Hi team,

I have little confusion between Application Explorer -- Table - Methods & Events

For example -  Cust Table- ModifiedField

PIC 1 -Method - 

5468.a1.jpg

Pic 2 Events - 

pastedimage1678855694608v1.png

OnModifiedField - (Post Event)

OnModifyingField - (Pre Event)

Kindly let me know is both (Pic1 & Pic2) are same? Only the approaches are different?

If required, Shall I use anyone of them?

Please give me more shed on this.

thanks!

  • @rp@n Profile Picture
    @rp@n 5,885 on at
    RE: Table - Method / Events in d365fo

    sure Girish

  • GirishS Profile Picture
    GirishS 27,803 Super User on at
    RE: Table - Method / Events in d365fo

    I think there is no such difference between the two methods. But while searching I found that ModifiedFieldValue method won't be called in the batch process, but modified field does get called.

    You can try implementing the two methods and analyze them.

    Thanks,

    Girish S.

  • @rp@n Profile Picture
    @rp@n 5,885 on at
    RE: Table - Method / Events in d365fo

    Hi Girish,

    Thank you for the update. Only one thing finally

    What is the use of below events? and when to use those ?

    Table - Events

    pastedimage1678862717157v1.png

    Please give me more shed on this.

    thanks!

  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,526 Super User on at
    RE: Table - Method / Events in d365fo

    Understood Girish. Thank you.

  • GirishS Profile Picture
    GirishS 27,803 Super User on at
    RE: Table - Method / Events in d365fo

    No, you cannot change that directly - You need to contact MS.

    Thanks,

    Girish S.

  • @rp@n Profile Picture
    @rp@n 5,885 on at
    RE: Table - Method / Events in d365fo

    Thanks Girish for the update

    Suppose the hookable is set to false and if required to set hookable to true. then we need to contact MS or we can directly change by myself ?

    pls give me more shed on this

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,803 Super User on at
    RE: Table - Method / Events in d365fo

    Event handlers supports public method, but Private and protected methods can also be accessed from event handlers if there is a hookable attribute is set to true on that method identifier.

    [Hookable(true}]
    private void methodName()
    {
    }

    Since the methodName has hookable attribute set to true you can write event handler for that method.

    Thanks,

    Girish S.

  • @rp@n Profile Picture
    @rp@n 5,885 on at
    RE: Table - Method / Events in d365fo

    Thanks Bharani

  • Verified answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,526 Super User on at
    RE: Table - Method / Events in d365fo

    No it's wrong. Private method can be accessed only from that class not from extension like coc or event handler.

    Event handler supports public method and coc supports both public and protected methods.

    Also you can try the same thing in vs so that you can get clear understanding.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,540 Super User on at
    RE: Table - Method / Events in d365fo

    Hi, I think its basically about placement of your code in a method. Sequence is Pre-Event Handlers are called first, then particular method will be executed. Before call to super, Pre Events are called, after super Post Events are called and in last Post Event Handlers

    Pre-Insert (Pre-Event Handler)

    OnInserting (Pre-Event)

    super ()

    OnInserted (Post-Event)

    Post-Insert (Post-Event Handler)

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,773 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,513 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans