

Integrating Data Validation into Microsoft Dynamics 365 CRM
The Microsoft Dynamics CRM platform offers several different pathways to extend its functionality. Data manipulation, standardization, and verification can be done by linking this CRM system to one of the Service Objects web services. The method of integration will depend on the version of Microsoft Dynamics your company uses.
Cloud-based instances
For the cloud-based instance a custom connector can be created using Power Automate.
- This solution makes use of the tools built into the CRM system. This allows for an easy integration with limited technical knowledge.
- HTTPS requests to the Service Objects web services can be made over the GET protocol.
- The CRM’s tooling will automatically generate the response fields. These response fields can be leveraged in any of your workflows. Conditional logic can be applied to the fields to make better business decisions.
Figure 1: Custom connector for DOTS Address Insight
Figure 2: Example workflow using Address Insight Connector
On-premise instances
There are two primary ways to integrate Service Objects products with an on-premise CRM installation. Each have their own pros and cons, but their primary functionality can be written in either method.
Standalone Application
Pros: Can easily run validation on large batches. Using the SDK allows you to pull collections of records for server side validations.
Cons: Requires code development/deployment/maintenance outside of the CRM system itself.
The standalone implementation leverages the Xrm library for authentication and data manipulation.
Authentication – Microsoft.Xrm.Sdk.Client – OrganizationServiceProxy
Authentication can be done through the OrganizationServiceProxy by passing in the proper credentials for your CRM system.
using (_serviceProxy = new OrganizationServiceProxy(serverConfig.OrganizationUri, serverConfig.HomeRealmUri, serverConfig.Credentials, serverConfig.DeviceCredentials))
Pulling records from CRM
There are multiple ways to form a query. Below are the different styles along with their respective advantages. With a query formed the Retrieve and RetrieveMultiple methods will allow you to execute your query and retrieve an Entity or EntityCollection. Here is a link to a developer guide with more information about these queries:
Running validation – Service Objects web service dependent
Calling the Service Objects web service is straightforward, but each call requires their own endpoints and input/output parameters. For detailed sample code that highlights our recommended best practices please see: https://www.serviceobjects.com/developers/sample-code
Pushing records to CRM
Here is a link to Microsoft’s documentation on how to update CRM records:
To update records after performing a validation you can leverage the Entity class along with the IOrganizationService.Update method.
Javascript form library
Pros: Can be triggered directly on form events (OnLoad, OnChange, and OnSave)
Cons: License key obfuscation isn’t possible with a client side script
To get up and running as quickly as possible I would recommend reading through Microsoft’s developer guide:
A basic integration with Microsoft Dynamics via JavaScript can be broken down into its component parts, with links to Microsoft’s documentation:
Steps to integration
Step 1: Write your custom JavaScript code
Step 2: Add your JavaScript code in a Script web resource
Step 3: Associate Script web resource to a form
There are three events that you can piggyback into:
OnLoad – Below is an example showing a notification on page load
OnChange – Using the OnChange event can allow you to perform an action when a field is updated
OnSave – The example below shows a basic dialog box when the form is saved. This is a great place to insert code to perform validations on your form data.
Recommended workflow
Here is a recommended sequence of operations: Pull data using getAttribute à use data as input to Service Objects’ validation à use Service Objects response to make informed business decision à push data back into form or follow established workflow
Need more assistance integrating our products with your Microsoft Dynamics CRM platform? Contact our knowledgeable technical support team anytime. We’re happy to help.