Outsystem Handshake
with
Dynamics 365 CRM - Anthony D’souza
Contents
Steps to configure a new
App Registration
Steps to configure the
application User in Dynamics 365 CRM
Assign CRM Roles to
Application Users
Integration and configuration
in Outsystem
Creation of “CRM Auth
Extension” in Outsystem
Using CRM Auth Extension
for Communication
Adding extension
dependency in the application.
Introduction
According to the fast growing technologies, low code platform plays a vital role in rapid application development with minimal development efforts. Outsystem is one of the low code platform which helps in rapid development along with integration with different technologies irrespective Web Services or Database. Outsystem also provides features to communicate to different products from in some form of connectors.
Being an Open source platform, it provides various connectors as part of forge components but the disadvantages is that the forge components always needs be in sync the current platform of the application and vice-versa, thus the control is not completely with the development.
Similarly in our project we had a requirement to connect to Dynamics 365 CRM via Outsystem using an available forge component or with some customization in Outsystem. Thus to achieve this and also to overcome the dependency of Forge component we came up with a approach which would connect to CRM using .Net code, Azure app, OS integration Studio, Dynamics 365 CRM.
Further in this document we would have a deep look into how we can create a communication channel between Outsystem and Dynamics 365 CRM.
Azure App Registration
· This is the first step for the communicating Outsystem with Dynamics 365 CRM.
· As a part of this steps we need to register and configure the Azure App which would act as a channel for communication.
· So below are the steps to configure the Azure App registration
Steps to configure a new App Registration
Step 1:
·
Login to https://portal.azure.com/ with the admin
credentials and go to search box and search for “Application Registration” and click on New
· Go to Branding Tab à Fill the details as mentioned in the screenshot below
Step 2:
· Go to Authentication tab à Click on Add URI à Update the Outsystem callback uri.
· Scroll down and select both the check boxes as shown in screenshot below
· Scroll down a bit more and based on the access who would access this registered app. (Recommended is to go with Single tenant)
Step 3:
· Go to Certificates & Secrets Tab à Click on New client secret à Fill the necessary details in the popup and based on your requirement select the key validity.
·
Note: One the details are
saved copy the data in the ID section as that is the secret key which would be
required in future for communication
Step 4:
· Go to API Permission Tab à Click on Add a Permission.
· Assign the necessary permission as displayed in screenshot below.
Step 5:
· Go to Manifest Tab à Make the necessary changes as shown in screenshot below and save the changes.
Step 6:
· Once the App Registration is completed go to Overview Tab and note the following values in notepad file for future reference.
o Application (client) ID
o Directory (tenant) ID
o Secret Key (Note:- This was noted at step 3)
CRM Configuration Changes
This is the 2nd steps for communication by adding the registered app in Dynamics 365 CRM
Steps to configure the application User in Dynamics 365 CRM
Step 1:
· Login to Dynamics 365 CRM with Admin Credentials
· Go to Advance Settingsà Settingsà Security à Users
· Go to Application Users view
Step 2:
· Click on New and enter Application Id
· Click on Save & Close
Step 3:
· Click on New and enter Application Id
Assign CRM Roles to Application Users
Step 1:
· Go to “OutSystemOdataCalls” user and click on Manage Roles
· Select “System Administrator” Role and click on OK
.Net Code for Authentication
This is the 3rd step for communication, the .net code would generate the Access Token for communicating with Dynamics 365 CRM
Step 1:
· Create a Class Library application and the code for authentication is as below.
Step 2:
· Create a DLL with and store the below DLLs for future use
o CRMAccessToken.dll (This DLL name would
changes based on the Namespace of your .net class library code)
o Microsoft.IdentityModel.Clients.ActiveDirectory.dll
Integration and configuration in Outsystem
Based on the configuration /changes done in MS Azure, Dynamics 365 CRM & .Net Code, it would be collectively further used in Outsystem.
Creation of “CRM Auth Extension” in Outsystem
Step 1:-
Login to Outsystem Ide and add an Extension Module in your application
Step 2:-
Open the Outsystem Integration Studio
Step 3:
Import the .net Assemblies as shown below.
Step 4:
Click on Next à Browse (Select Microsoft.IdentityModel.Clients.ActiveDirectory.dll) à Next
Step 5:
Select the specific methods from assembly as shown in below screenshot à Nextà Finish
Step 6:
Repeat the step 3 & 4 for CRMAccessToken.dll for
Step 7:
Select the specific methods from assembly as shown in below screenshot à Nextà Finish
Step 8:
Click on “1-Click Publish” button as shown below
Step 9:
The extension is published
Using CRM Auth Extension for Communication
Adding extension dependency in the application
Step 1
Click on Manage Dependencies
Step 2
Search for the Extension created and the add the selected method as shown in below screenshot
Step 3
The dependency is added into this application.
Consume the CRM API
Step 1
Go To Logic à Integrations à REST à Consume REST API...
Step 2
Consume the API as shown in screenshot below
Define Server Action
Step 1:
Go To Logic à Server Actions à Add New Server Actions à Name it as GetTop3CRMAccounts
Step 2:
Set attributes for Manage Access Token as shown below
Notes: The highlighted values
are the values which were asked to store in the initial part of the document
Step 3:
Set attributes for GetTop3Accounts consumed API as shown below
Note:
1) Generated Access Token is a local variable which is assigned with value returned from ManageAccessToken Extension method
2) Response is the output parameter which is assigned with the value returned from consumed API
Using Server Action on UI
The above mentioned Server can be used in any Screen action and the data returned can be bind into the screen as shown below