Blogs

Blogs

Liferay and MS Dynamics CRM

An Integration POC

A request we see often from customers is the ability to integrate Liferay with a CRM system. At the same time, we all know that Liferay is strong when it comes to integrations with external systems, offering several different approaches and tools to achieve our needs. But sometimes, knowing is not enough and we do need to show it! 

On this quick blog post, we have a simple proof of concept, for a Liferay and Microsoft Dynamics integration. 

This POC goal is to showcase how we can integrate Liferay DXP with Microsoft Dynamics CRM, not only to pull information from MS Dynamics to be displayed on Liferay side but also to push information from Liferay to MS Dynamics. The challenge we proposed to ourselves was to be able to:     

  • List MS Dynamics CRM accounts on a Liferay widget;    
  • Create a new MS Dynamics account from Liferay. 

 

The integration approach was to leverage the MS Dynamics Web API, which implements the OData (Open Data Protocol) v4. OData is an OASIS standard for building and consuming RESTful APIs over rich data sources. 

On the Liferay DXP side, we have 3 simple OSGi modules: 

  • Configuration module, which allows us to configure the connection details to the target MS Dynamics account; 
  • Rest client module, responsible for calling the MS Web API endpoints; 
  • Front-end widget, to display the data and possible actions to our end users.  

 

You can find a short video of this POC in action here: https://www.youtube.com/watch?v=ZZTKHMwlJlw

And the POC repo here: https://github.com/fafonso/liferay-ms-dynamics-poc

I hope you find this POC useful!

Thanks Filipe ! This is helping me start up a project which involves integrating Dynamics CRM from Liferay DXP v7.3. 

The code in this POC provides a configuration form field where an access token can be entered - which is for testing only as such tokens expire (as pointed out in this blog). To programmatically get the access token from https://login.microsoftonline.com/tenantId/oauth2/token I extended two classes in the ScribeJava OAuth library. 

class MSDynamicsApi extends BaseMicrosoftAzureActiveDirectoryApiclass MSDynamicsOAuth20Service extends OAuth20ServiceThe extending was necessary to use a 'resource' parameter MS Dynamics CRM expects instead of 'scope'. 

This blog saved me much time. Thanks Filipe !

Hey Jack, 

I'm happy to hear that it was useful to you, thank you so much for the feedback :) 

All the best,

Filipe