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

Notifications

Announcements

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

I have the same question (0)
  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    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.

  • Community Member Profile Picture
    on at

    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;

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Shidin Haridas Profile Picture

Shidin Haridas 2

#1
SA-08121319-0 Profile Picture

SA-08121319-0 2

#1
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans