Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Plugin Dynamics 365 CRM

Posted on by 185

Hi,

I have a plugin registered (post-operation,synchronous) on create of a custom entity. In the plugin , I am trying to share (using some custom code) the record with another user. My problem is 

The code is throwing an exception as "the record with guid = {XXXXX-XXXXX-XXXX} you are trying to share doesn't exist". 

This is strange. Because, I registered plugin on post-operation. That means , after the record got created in DB, the plugin triggers.

Any idea why it's throwing exception ?

Also , another thing that I observed while debugging is , context.UserId and context.InitiatingUserId are showing same values through I registered plugin under different user.Here both are showing my Id i.e who is performing create record. Any idea on this ?  

*This post is locked for comments

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: Plugin Dynamics 365 CRM

    Plugins are in transaction phase even in post. If any thing wrong happened then all changes will be revert back.

    You can try it with creating a plugin that throw exception and register in post create.

    You can not share a record until it get create. I suggest you to create a workflow instead of plug-in or register your plugin in asynchronous mode.

    For second point:

    Can you please share screen shot of your plugin step?

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans