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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Webhooks and Azure Functions / Dynamics 365 v9 Trigger options?

(0) ShareShare
ReportReport
Posted on by 5

Hello.  

I've created an Azure Function that I'm able to successfully call via webhooks from Dynamics 365. I registered the webhook on the Create entity by using the plug in registration tool.

Questions:

Do we have to register a webhook on an entity?

Can a webhook be triggered without an entity? eg: Can a webhook be triggered via a custom url?

Once our code is done executing and complete in our Azure function, is there a way to notify Dynamics ?

We are wanting to trigger an azure function that returns a guid back to Dynamics 365.

Thank you!

I have the same question (0)
  • Suggested answer
    Johao Larios Profile Picture
    1,795 on at

    Hello there,

    Please find answers to your questions below:

    Do we have to register a webhook on an entity?

    --->webhooks are registered against MEssages using Plugin Registration tool.  The messages are operations that happen during the pipeline execution of actions on entities. So, yes. You have to register it on an entity.

    Can a webhook be triggered without an entity? eg: Can a webhook be triggered via a custom url?

    --->You will always need to triggered then by calling an event inside Dynamics CE. So, if you have a custom URL, you can build that custom url in a way that it performs maybe an update in an entity and register the webhook in the update message for that entity.

    Once our code is done executing and complete in our Azure function, is there a way to notify Dynamics ?

    ---Yes, if you call the azure function from a plugin or from a workflow, as described in this article written by the community: www.inogic.com/.../

    We are wanting to trigger an azure function that returns a guid back to Dynamics 365.

    This is our documentation for webhooks: docs.microsoft.com/.../use-webhooks

    More useful information for you:

    docs.microsoft.com/.../write-custom-azure-aware-plugin

    Please do let me know if you have any more questions or please mark this one as an answered.

    regards,

  • JFDDynamics Profile Picture
    5 on at

    Hello Johao,

    Thank you for the quick response.

    We are able to see the webhook call our Azure function.  But, can we get data returned from the Azure function in Dynamics?  How can we actually see  the response body and where is it stored?

    We looked at the following article, but it doesn't seem to show where the data is in Dynamics.

    www.inogic.com/.../

  • Suggested answer
    Johao Larios Profile Picture
    1,795 on at

    Hello JFDDynamics,

    I you see that article, in the next method:

    private static async Task<string> Post2Azure(UriBuilder uriBuilder, ITracingService tracingService, IOrganizationService service)

    They are calling an azure function from a workflow:

    HttpResponseMessage response = client.PostAsync(uriBuilder.Uri, byteContent).Result;

                   if (response == null)

                   {

                       tracingService.Trace("no response received");

                       throw new InvalidOperationException("Failed to obtain the httpResponse");

                   }

                   result = await response.Content.ReadAsStringAsync();

                   tracingService.Trace("response read: " + result);

    Then, they take the information from a JSON that is coming from there and creating a contact in CRM with that information:

     JObject ob = JObject.Parse(result);

                   tracingService.Trace("responseparsed to json: ");

                   //Create a CRM contact

                   Entity contact = new Entity("contact");

                   contact["firstname"] = ob["Fname"].ToString();

                   tracingService.Trace("firsname to json: " + ob["Fname"].ToString());

                   contact["lastname"] = ob["Lname"].ToString();

                   tracingService.Trace("firsname to json: " + ob["Lname"].ToString());

                   contact["emailaddress1"] = ob["Email"].ToString();

                   Guid id = service.Create(contact);

                   tracingService.Trace("contact created " + id.ToString());

    Hope this helps to clarify this even more.

    Let us know if you have more questions.

    Regards.

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

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 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 47 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 32

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans