Skip to main content

Notifications

Customer Service forum

Pre-operation AddMember message cannot retrieve contact record by contactid when invoked from a Post-operation Create Contact

Posted on by 5

I have a post-operation create plugin that is triggered for the creation of a new contact.  This plugin looks at a preset list of marketing lists and attempts to add the newly created contact to those preset marketing lists. 

I also have a plugin that operates on the message "AddMember" during the pre-operation stage called PreventDuplicates.  This plugin attempts to retrieve the contact record based on the contactid (entityid) passed in because it needs more attribute information regarding the contact (especially the ownerid).  PreventDuplicates verifies there are no other contacts in the specified marketing list that has the same email address and is owned by the same owner.

The problem I am running into is that the PreventDuplicates plugin is reporting back "contact With Id = xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx Does Not Exist".  It seems like during the Post-operation phase of a Create message, the record hasn't yet been committed to the database.  I would appreciate if anyone has a suggestion on how to alleviate this problem.

Categories:
  • PhengYang Profile Picture
    PhengYang 5 on at
    RE: Pre-operation AddMember message cannot retrieve contact record by contactid when invoked from a Post-operation Create Contact

    Thanks David, that was what I was missing.  Changing my post-operation plugin to process asynchronously resolved my issue.

  • Verified answer
    David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Pre-operation AddMember message cannot retrieve contact record by contactid when invoked from a Post-operation Create Contact

    In a synchronous post-operation plugin step, any changes are still part of the original transaction. Try registering the post-operation create step to run asynchronously

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

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,802 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,129 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,154

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans