web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer Service forum

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

(0) ShareShare
ReportReport
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:
I have the same question (0)
  • Verified answer
    David Jennaway Profile Picture
    14,065 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

  • PhengYang Profile Picture
    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.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

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 > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans