Logic Apps and Dynamic’s CRM Online Connector

An easy way of starting to Integrate with your Dynamic CRM Online instance. It just takes a few minutes and some easy steps to get started!

Getting started with the Connector

Getting started with the Connector is easy, all you need is an account on Dynamic CRM Online. Read more how to connect and use certain actions/triggers etc. at the MSDN forum.

https://azure.microsoft.com/sv-se/documentation/articles/connectors-create-api-crmonline/

Working with the Connector

It’s fairly easy to get started with the Connector, selecting data and create/update records, but as soon as the business requirments lands on our table it gets a bit trickier. Often we need to handle scenarios where we link relations and/or assign ownership to the entity we are createing/updating. Then we need to know a little more about the setup in Dynamic CRM and our best friend for this is the Settings and Customizations tab.

crm_Settings

By then selecting Customize The System a new window will open and it’s now possible to go in and verify the entity, check keys, relations etc.

crm_customizethesystem

Using Navigational properties

Navigational properties are used to link entities together, these can be set directly within the body of the update/insert request. This will then be linked correctly inside Dynamics CRM Online, an example would look like this, where we are setting the currency (transactioncurrency) of the account using the navigational property_ transactioncurrencyid_value, example:

 "body": {
"_transactioncurrencyid_value": "@{first(body('Get_intgrationMetadata')['value'])['_stq_defaultcurrency_value']}",
"accountnumber": "@{triggerBody()['data']['Company_ID']}",
"address2_city": "@{triggerBody()['data']['Town_city_state']}",
...
..
}

Setting owner

A frequent used operation is Assigning owner, this is now implemented so it’s possible to do it directly via the Update/Create operation instead of a separate operation as previously.

In the Dynamic CRM Online Connector it’s easy to set the owner just apply the following fields _ownerid_type wich is set to either systemusers or teams _depending on the owner type next is the __ownerid_value wich is the key to the user, an example as bellow:’

"body": {
"_ownerid_type": "systemusers",
"_ownerid_value": "@{first(body('Get_owner')['value'])['systemuserid']}"
}

Lessons learned

Don’t overflow the CRM! Since Logic Apps is really powerfull in parallelism it’s good to have some sort of control over how many new instances are created and executed against Dynamics CRM. We usually try to make sure that there are no more than 200 parallel actions towards a CRM at any given time.

Learn how to check fields, properties and keys since you will get stuck at errors when sending in the wrong type and then you will need to check what type it is. OptionSets are commonly used and good from GUI perspective but it’s not as good in integration since it’s translated to a number that we from integration often need to translate to a code or text but learning how to check the values inside CRM will speed up this process.

When we started using the Connector there were problems with assigning ownership and handling float numbers, these where fixed early by the product group and since then we haven’t found any issues with the way we are using the Connector.

Posted in: •Integration  •Logic Apps  | Tagged: