Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

EventSubscriber Modifies a Record when OnBeforeModify - how do I prevent recursion?

Posted on by
I have a fairly simple eventsubscriber that watches the Job table, and onBeforeModify updates a field. The problem is, when this field is updated, the eventsubscriber enters a state of recursion. I recollect there was a way / flag to prevent this, but am not seeing anything.
 
Any suggestions?
Categories:
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    EventSubscriber Modifies a Record when OnBeforeModify - how do I prevent recursion?
    Hi,
    You need to debug your application why is repeating that code again and again.
     
    Thanks.
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,696 Super User 2024 Season 2 on at
    EventSubscriber Modifies a Record when OnBeforeModify - how do I prevent recursion?
    Hi, I agree with Ram, this should be the trigger of OnModify executed elsewhere, you can try to debug it step by step.
     
    Hope this helps.
    Thanks.
    ZHU
  • Ram Pranav Profile Picture
    Ram Pranav 50 on at
    EventSubscriber Modifies a Record when OnBeforeModify - how do I prevent recursion?
    Hi,
     
    I don't think there is a flag to stop recursion. BC usually throws an error on runtime if the code is recursive. You might want to double check your code for any accidental recursion.
     
    Regards,
    Ram Pranav.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans