SAP Cloud Platform Integration tools, SAP Process Integration

Receiving events from Dynamics 365 CRM using webhooks


Starting with Dynamics 365 CRM 9.0 you can send data about events that occur on the Dynamics server to external applications like SCPI application using webhooks. Webhooks is a lightweight HTTP pattern for connecting Web APIs and services with a publish/subscribe model. Webhook consumers register webhook plugins about entity events. Dynamics will use these webhook plugins to make requests to consumers endpoints with information about the events.

The Advantco adapter supports many important features that are critical when integration with Dynamics 365 CRM online or on premise. The Advantco adapter handles the most complex tasks so the CPI developer can focus on the mapping logics. Topics like authentication, pagination, batch operations, … are best handled by the adapter and must not assume prior knowledge of the Dynamics 365 CRM API by the SCPI developer to be able to implement common integration flows.

Our scenario

An event is created in Dynamics 365 CRM whenever an account is updated. We want to receive this event so the respective customer in SAP is updated with the new information from Dynamics.

Webhook setup

Using the Plugin Registration Tool, we register a new webhook to receive this update event for the account entity.

First, we specify the name of the endpoint url to which Dynamics will send the event in case of an update to an account. We select WebhookKey for authentication mode and specify the iflow ID. We will show you below how to get the ID for your specific iflow in SCPI.

We specify the entity and the attributes in the Step configuration screen. The execution mode for the event can be synchronous or asynchronous.

Advantco Dynamics 365 CRM Workbench

The Workbench is an important WEBUI tool to define and test the connection to Dynamics, generate schemas for different type of integration use cases and it can support testing payloads directly.

To be able to receive and map the account event in the iflow, we need to generate the schema for the webhook response for the account entity. Import the generated schema into your iflow as an external resource.

Develop the iflow in SCPI.

The simple iflow consist of one sender channel using the Advantco Dynamics 365 CRM adapter and a RFC receiver channel. The iflow ID is available by click on the General tab, you need this ID when defining the webhook.

Check the Enable Consuming Webhook checkbox to activate the channel to receive the account update event from Dynamics. It cannot be easier.

For completion, this is how the mapping looks like. We map the webhooks response schema to the BAPI BAPI_CUSTOMER_CHANGEFROMDATA. The schema for the webhooks response was generated using the Advantco Workbench as described above.

Finally, the receiver channel is a RFC channel calling the on premise SAP backend system using the predefined Cloud Connector connection.

Testing the use case

When we update an account in Dynamics 365 CRM, an event is triggered and sent to the webhooks endpoint url.

We can see that the iflow is triggered in SCPI.

Leave a Reply

Your email address will not be published. Required fields are marked *