Outsystem handshake with Dynamics 365 CRM

Outsystem Handshake

with

Dynamics 365 CRM  - Anthony D’souza

 

Contents

Introduction. 2

Azure App Registration. 3

Steps to configure a new App Registration. 3

CRM Configuration Changes. 7

Steps to configure the application User in Dynamics 365 CRM... 7

Assign CRM Roles to Application Users. 8

.Net Code for Authentication. 9

Integration and configuration in Outsystem.. 10

Creation of “CRM Auth Extension” in Outsystem.. 10

Using CRM Auth Extension for Communication. 16

Adding extension dependency in the application. 16

Consume the CRM API 17

Define Server Action. 19

Using Server Action on UI 21

 

 


 

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 toOutSystemOdataCalls 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

 

s

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

Latest Post

XRM Toolbox - Entity Bulk Data Delete Tool

Entity Bulk Data Delete Tool      This XRM Toolbox tool will help users to delete the data which is older than the specified duration, event...