Using Scribe Online Integration Event with Dynamics 365 Plugins - Part 3
- MB
- Jul 15, 2020
- 2 min read
Updated: Jul 16, 2020
If you have read Part 2 of this series you will know that we used Scribe Online Integration Event solution and configured an action in CRM to be called. This action would kick off the integration process and call the associated Scribe Online map.
The first order of business was to figure out how to retrieve the URL of the Scribe Online Endpoint to run. To make our lives easier we built a helper class in our plugin project that would do that for us. Using our helper class, we could easily call the RetrieveSettingUrl method, pass in the desired key, and it would return us the appropriate Endpoint URL that was stored in the CRM field for that record. We build a QueryExpression, retrieving just the URL field, and filtering on Integration Setting records that are Active and have the key equal to that passed in. We make sure to validate that there is only one record retrieved and return the URL, else we just return a blank value that we can validate later.

The toughest part of the whole integrations was trying to figure out how to pass the correct parameters to the Scribe Online map, and used Postman to validate our requests before further developing our plugin. Once we had validated that the URL could be called and that our parameter was being passed in correctly, we created another method in our helper class to make our lives that much easier. This time, it accepts our parameters and sends a POST request to the Endpoint URL, which is how Scribe Online interprets that the map should now be ran. In our method, we create a new HttpClient and build our parameters to pass in. Once we encode the parameters and call the URL, Scribe Online should take over the rest.

The parameters we are passing in are in a raw string format. After many attempts using Postman, this was the type that actually made it successfully. We are doing all asynchronous processing in our methods to be as resource-efficient as possible. Now with those two methods complete we can put them together to complete our integration.
In our main plugin project, we used two methods to separate the processing from the integration event. As shown, we validate that the InputParameters has a target and that the target contains the IntegrationKey field (which we set in our workflow inside CRM). Using the IntegrationKey field, we pass that into our IntegrationHelper class to retrieve the associated URL. After some URL validations we can then use the IntegrationHelper class to call the Endpoint URL of the Scribe Online map.

In the final part of this blog, we will look at the Scribe Online execution logs and how to verify that the map is actually being called, as well as some closing statements and conclusions for the entire process.
Comments