Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Prevent rollback of tasks when throwing exception in plugin

Posted on by 190

Hi,

Can anyone suggest a way to prevent plugin tasks being rolled back when throwing an exception. My plugin fires on create of record for entity A. Within the plugin I create another record for a different entity (entity B). I want the plugin to prevent the actual creation of record for entity A. When I throw an exception, everything rolls back including the creation of record from entity B. I have tried Pre-Validation and Pre-Create stages and it happens for both.

Any advice greatly appreciated

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Prevent rollback of tasks when throwing exception in plugin

    pre-validation should work in that case as pre-validation operation does not enter DB transaction so there is no question of rollback of entity B creation. May be you are missing something in the code , try to debug and see your code is executing correctly . You can add trace log and enable tracing as well.

    https://www.inogic.com/blog/2017/03/plugin-pre-validation-operation-to-show-an-error-message-as-well-as-log-the-error/

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans