Register Azure Function as a Webhook in Plugin Registration Tool
Webhooks are user defined HTTP endpoints or endpoint
URL that are directly triggered by some events.
This part will focus on-
·
How to register Azure Function as a Webhook in
Plugin Registration Tool?
·
How to get the Execution Context in Azure Function ?
This is the same Execution Context that we get in Plugin when we perform CRUD operation in Dynamics CRM.
Solution
We will create Test Entity and add a field Request
(Single of Text) on the form.
We will register a Webhook in Plugin registration
Tool and a Step on Create of Test Entity Record.
We will check the Azure Function Log and check the presence of Execution Context in it.
We will use the same Azure Function that we have created in Part
2 - Create Azure Function using Visual Studio
Step 2 – Click on “Functions” and then Azure
Function.
Step 3 – Click on “Code + Test” and then “Get
function URL” to copy the End Point URL.
This URL will be used to register Azure Function as a Webhook in Plugin Registration
Tool.
Step 4 – Open Plugin Registration Tool and sign-in to target environment.
Step 5 – Click on “Register” and then on “Register
New Web Hook”.
Step 6 – Fill all the details as below. Click “Save”
button.
Step 7 – After Endpoint URL registration, click right-click on it
and create a new Step.
Step 8 - Here we will use Test Entity and register a
step on Create of Test Entity record (Post Operation, Sync). You can also use
Async.
Open the Azure Function in Visual Studio, add and comment out lines accordingly. Publish Azure Function.
Note: No need to update anything in Plugin Registration Tool as we do in Plugin each time after we update it.
Step 10 – Go to your Test Entity and make a new
record.
Note: Don’t expect any updates back to this
record after creation as we have not created IOrganization Service in
the Azure Function code. We are focused to understand the Execution
Context that we get by registering Azure Function as a Webhook.
We will update the Dynamics CRM record via Azure Function in the coming next Part.
Step 11 – To test the Execution Context coming from Dynamics CRM, we will open the log in the Azure Portal, generated after the record is created.
Go to your Azure Function and click “Monitor”.
Step 12– Below is the Log that is generated after we created the test entity record. This means Azure Function triggered
successfully.
Step 13 – Open the Log and find the Execution
Context.
Whoooooo!!! We did it. :)
Happy Learning, LET'S SHARE !
No comments:
Post a Comment