Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create entity and webhook call

(0) ShareShare
ReportReport
Posted on by

I have managed to make a web hook call when if I update a contact entity, it will call a web hook endpoint. In this webhook call, I also call the CRM API to get the contact entity since I cannot parse the post image successfully. In any event, works great.

However when creating one for creating an entity, the problem I am having is that the entity in CRM is not actually committed to CRM but do get an entity ID. This makes sense however I am unable to then convert the JSON being posted into a proper Contact object as it fails deserialization.

How can I get the contact entity, on create, so I can pull out the properties I need and ALSO set a property in the contact entity?

using Dynamics 365.

thank you.

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Create entity and webhook call

    Thank you.

    The code is simple but that is not the issue here, in essence.

    I have a webhook and I create a post validation create message image. (Create on contact and we have customized contact entity).

    Message: Create

    Primary Entity: contact

    Event Handler (WebHook) CreateContact

    Event Pipeline stage of execution: PostOperation in Sync mode

    Deployment: Server

    Now, when the contact is created in CRM 365, it calls the webhook - great. BUT when retrieving the entity with the given ID, it fails to find it and throws an error that the entity was not found.

    How can I get it to invoke the web hook AFTER CRM itself creates the entity so I can then access the entity in the webhook using the ServiceProxy/context?

    The code to retrieve is simple. This works for UPDATE but NOT Create:

    // Create Organization Service Proxy

               var _serviceProxy = new OrganizationServiceProxy(this.CRMEndpointURL, null, clientCredentials, null);

               _serviceProxy.EnableProxyTypes();

               var orgContext = new OrganizationServiceContext(_serviceProxy);

               // retrieve the contact object

               var cols = new ColumnSet(true);

               Contact c = _serviceProxy.Retrieve("contact", contactID, cols) as Contact;

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,914 on at
    RE: Create entity and webhook call

    Hi, CRM also have transaction scope. If I understand correctly about your question you must creating :

    1. Create plugin on pre-operation/post-operation (In transaction scope).

    2. After create, you need to retrieve using Service.Retrieve("entityName", entityId, new ColumnSet("attr1", "attr2"));

    3. Do your operation, either calling another web services and update your entity which just create on step no 2.

    Please give us your code and what error given from CRM so we more clearly understand about your situation.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans