← Back to table of contents

Microsoft Dynamics 365 integration

dynamics-365-logo-512.png

SmartBot360 makes it easy to have bots create Microsoft Dynamics contact leads. Here are the steps.

Step 1

First, you will need to create a Microsoft Azure account which can be found here. https://azure.microsoft.com/en-us/. Once you are logged in, click on App registrations then New registration to register a new application and set a Web redirect URI using to {{your server URL}}/microsoftdynamics/ (e.g. https://demo.smartbot360.com/microsoftdynamics/). Once you register your application, under overview you can see the ClientID and Tenant ID, which you will need later.

MD1.png

Step 2

Under Certificates & secrets click on “New client secret” button and set the client secret to expire never. Copy the value of the client secret as it will be used later to integrate Microsoft Dynamics 365.

Step 3

Click API permissions and the “Add a permission” button and select Dynamics CRM and check user_impersonation as shown in the picture, then click Grant admin consent for {Account Name}. If the “Grant admin consent…” button is greyed out, have an admin grant permission for you.

md4.png

Also add these Microsoft Graph permissions and grant them admin consent as well:

Step 4

Once you have logged on your Microsoft Dynamics 365 account you will need to add an application called CRM Hub. Enter the CRM Hub app and you will need to copy your URL from the address bar containing *.crm.dynamics.com/ (e.g. smartbot360dev.crm.dynamics.com/). This url will be used to set up Microsoft dynamics integration with SmartBot360.

md5.png

Step 5

Go to the SmartBot360 Management Dashboard and click the SETTINGS page, and under Integrations add the required information retrieved from the steps above. You will need to add the Client ID, Client Secret, Tenant ID, and Microsoft Dynamics 365 Url.

md6.png

Click ‘Save Changes‘ and you should be redirected to Azure to authorize your app and its permissions. Press Accept. If you see this window in the screenshot below then you must ask your administrator to make you an admin in order to receive the appropriate privileges. Then in Azure, click the “Grant admin consent…” button yourself and then press the Save Changes button on the dashboard again to authorize your app and its permissions.

Otherwise, if the authorization is successful then you should see this window:

Step 6

Go to CHATBOTS to create a Flow Diagram bot. The bot should collect some information about the end user (name and email are necessary) and then create the ticket. You can use the User Profile box to collect user profile information as shown below:

Step 7

Then, add a Microsoft Dynamics box as shown below. Note that the four variables (user_email, user_fname, user_lname, user_phone) were collected in the first four boxes of the diagram. Only one of first or last name is needed, as they are concatenated into one name before submitting to Microsoft Dynamics. When the bot execution reached the Microsoft Dynamics box, the bot will create a Microsoft Dynamics contact for the end user specified in the four fields, with the whole conversation up to that box as the ticket content.

OPTIONAL STEP (I) - STORE CUSTOM MIcrosoft Dynamics OBJECT FIELDS

To add custom fields for your Microsoft Dynamics contact, click on the ‘+ Add Field’ button

Use the dropdown menu to select the custom field that you want to add.

Type in the text input field with the value you want to set the custom field to be. You can also use a user variable as a value for a field. Examples shown below, where “user_middlename“ is a user profile field, whereas ‘Software Engineer’ is a constant (i.e. not a field)

OPTIONAL STEP (2) - DUPLICATE CONTACT DETECTION

Maintaining clean, accurate data is one of the most important things you can do to get the most out of Microsoft Dynamics. The Microsoft Dynamics box has a flow condition that will be taken if a duplicate Dynamics Contact entity has been detected when inserting a user.

In the picture above, there are three routes the Microsoft Dynamics box can take. If Microsoft Dynamics detects a duplicate entry when the user reaches this box, the bot will take the flow with the ‘Contact already exists’ condition and update the user. Our system will update the user on Microsoft Dynamics that has same phone number that is stored in the user phone profile field. It is recommended to set your duplicate/matching rules on your Microsoft Dynamics account to make duplication checking much more in tuned with your preferences. For more information, please visit the Microsoft Dynamics documentation about managing duplicate records here: Microsoft Dynamics Duplicate Detection

OPTIONAL STEP (3) - ALLOWING OTHERS TO ACCESS THE CRM

Sharing a business app you created in Microsoft Power Apps with other users involves a few steps. Here's a general guide on how to share your Power Apps with others:

  1. Publish Your App:

    • Before sharing, make sure your app is published. Go to Power Apps Studio, click on "File" in the upper-left corner, and select "Save" to save your changes.

    • Then, click on "File" again and select "Publish" to publish your app. This makes it accessible to others.

  2. Share the App:

    • In the Power Apps Studio, select the correct environment that you created the app in, select Apps on the left navigation pane and click the 3 vertical dots on the app you want to share. Click the Share button.

    • Choose the users or groups with whom you want to share the app. You can share it with specific individuals or groups within your organization.

  3. Specify Roles:

    • If your app uses roles, make sure to assign users to the appropriate roles when sharing. Roles help define different levels of access within the app.

OPTIONAL STEP (4) - ADDING COLUMNS TO THE CRM

If you want to add a certain field when viewing a contact, you must do it through Power Apps. Edit your CRM app through Power Apps and edit the Contacts table/form to include the custom field you desire. Click Publish to save your changes, and now you should be able to view the newly added field when you click on a contact within your CRM.

LIMITATIONS

Certain custom fields may not work as it requires a certain data type or format. At the moment, the properties listed under the type ‘Edm.String‘ are confirmed to be working. Please visit Contact Entity Type for more information about the Contact properties.