Microsoft Dynamics 365 CRM Integration – Server Side

Introduction

3CX provides integration with Microsoft Dynamics 365 online CRM via the 3CX API for CRM. The configuration is done server-side, in an easy and straightforward way. This integration provides many benefits to users of 3CX and Microsoft Dynamics 365, including:

  • Contact Synchronization – Inbound calls from external numbers trigger a contact lookup in your CRM, and contact details are added to 3CX Contacts. This way, the caller name is automatically shown in your phone display when you receive the call.
  • Call Pop-ups – When using the 3CX Web Client, the customer record is brought up to you automatically when you receive an inbound call.
  • Call Journals – Calls are logged as call records in the CRM.
  • Create a new contact automatically when a call is received from an unknown number.
  • Click to Call – Launch calls straight from Microsoft Dynamics 365 via 3CX, using the 3CX Browser Extension.

This guide takes you through the steps required to setup your Microsoft Dynamics 365 with 3CX.

Microsoft Dynamics 365 Online Configuration

General Settings

  1. Go to the Microsoft Azure App Registrations page using your Microsoft Dynamics 365 Online account, i.e. “Azure services” > “App registrations”.

2. Click on “New registration” and complete the app information

  1. “Name” – enter the app’s name, e.g. “3CX Server-side”.
  2. “Supported account types” – leave default or update based on your needs.
  3. “Redirect URI (optional)” – select “Public client/native (mobile & desktop)”. For the Redirect URI enter https://my-pbx.example.com:5001/api/oauth2crm, using the URL for your 3CX Management Console.
  4. Click “Register” to proceed with the app registration.

3. In the app “Overview” page, note the values of these fields for configuring 3CX later:

  • “Application (client) ID”.
  • “Directory (tenant) ID”.

4. To add the required permissions to access the Microsoft Dynamics 365 Online information, click on “API permissions” > “Add a permission” > “Dynamics CRM”.

  1. Enable the “user_impersonation” permission and click on “Add permissions”.
  2. In the “Grant consent” section, click on “Grant admin consent” and select “Yes” to confirm the app’s permissions.
  3. Wait for ~10 minutes for the app changes to become available.

Call Journaling

1. To report external calls to Microsoft Dynamics 365, you need an existing or custom field on the “User” entity to contain the agent extension number. 3CX uses this field to map the agent’s extension number that received the call, to the Microsoft Dynamics 365 user. See more info on how to add custom fields.

Important: Customization rights are necessary to create custom fields.

2. On the upper right corner of the screen go to “Settings” > “Advanced Settings”.

3. Go to “Customization” > “Customizations”.

  1. Go to “Customize the system”.
  2. On the left side bar go to “Components” > “Entities” > “User” > “Fields”, to show a list with all the User fields.
  3. If you want to:
    • Use an existing field to hold the extension number, take note of the Name of that field and jump to step 9.
    • Create a new field, click on “New” on the upper left corner.
  1. On the new window that appears, specify the Display Name and the Name of the field. Take note of the Name of the field, then set the “Type of data” to “Single text line” and click on “Save and close”.
  2. Press “Publish All Customizations” on the upper left corner of the page.
  3. To add the selected field to a form, go to “Components” > “Entities” > “User” > “Forms”, and double-click the form to customize and include the field.
  1. Select the “Extension” field from the field explorer, and drag it to the desired location on the user form.
  2. Click on “Save and close”, and then “Publish All Customizations”.
  3. Go again to “Advanced Settings” > “Users and permissions” > “Users”.
  1. Open the user for whom you need to report calls, and populate the added field with the extension number.

3CX CRM Server Side Configuration

General Settings

  1. Login to the 3CX Management Console and go to “Settings” > “CRM Integration” > “Server Side” tab.
  2. Select Microsoft Dynamics 365 from the dropdown list.
  1. Enter the values for the Application ID and Tenant, taken from the previous steps. For the domain, enter the URL you use to access your Microsoft Dynamics 365 Online account.
  2. Press the Authorize button to perform the authorization. A new tab will be opened, and you will be requested to grant access to the application you just created.
  1. Press Accept to grant access. The refresh token will be shown under the Authorize button.

Call Journaling

1. If you want to report external calls to the CRM, check the Enable Call Journaling checkbox and configure the parameters below. Please note that this feature is only available for 3CX v16 and later installations.

2. Call Journaling parameters are:

  • Extension Field ID: The unique id (Name) of the User Form entity field created in the previous step, that holds the extension number of the agent. This parameter must be set when call journaling is enabled. This parameter is used to map the 3CX extension receiving the call to a Microsoft Dynamics 365 User, and assign the call to that specific User.
  • Call Subject: The subject of the call.
  • Answered Inbound Call: Description for answered inbound calls.
  • Missed Call: Description for missed calls.
  • Answered Outbound Call: Description for answered outbound calls.
  • Unanswered Outbound Call: Description for unanswered outbound calls

3. Please note that you can use variables in the Call Journaling parameters. Variables are specified between [], for example the external number is specified as [Number]. The available variables are:

  • CallType – The type of call, it can be “Inbound”, “Outbound”, “Missed”, or “Unanswered”.
  • Number – The external contact number (the number dialed for outbound calls or the caller number for inbound calls).
  • Agent – The extension number of the agent handling the call.
  • Duration – The duration of the call in “hh:mm:ss” format.
  • DurationTimeSpan – The duration of the call as a TimeSpan object, which can be formatted as the user wants.
  • DateTime – The start date & time of the call, in local time zone, formatted using the local culture from the 3CX server.
  • CallStartTimeLocal – The start date & time of the call, in local time zone, as a DateTime object, which can be formatted as the user wants.
  • CallStartTimeUTC – The start date & time of the call, in UTC time zone, as a DateTime object, which can be formatted as the user wants.
  • CallEndTimeLocal – The end date & time of the call, in local time zone, as a DateTime object, which can be formatted as the user wants.
  • CallEndTimeUTC – The end date & time of the call, in UTC time zone, as a DateTime object, which can be formatted as the user wants.

Contact Creation

  1. If you want to create new contacts in the CRM when a call is received from an unknown number (not found in both 3CX and CRM), check the Enable Contact Creation checkbox and configure the parameters below. Please note that this feature is only available for 3CX v16 and later installations.

2. Contact Creation parameters are:

  • Create Lead or Contact – The entity to be created (Lead/Contact).
  • New Contact First Name – The first name of the newly created Contact.
  • New Contact Last Name – The last name of the newly created Contact.
  • New Lead Subject – The Lead subject when a Lead is created.

3. Please note that you can use variables in the parameters. Variables are specified between [], for example the external number is specified as [Number]. The available variables are:

  • Number – The external contact number (the number dialed for outbound calls or the caller number for inbound calls).