How to Integrate Comm100 with Dynamics 365
Introduction

Dynamics 365 is a product line of enterprise resource planning and customer relationship management intelligent business applications.

Comm100's integration with Dynamics 365 allows you to easily access customer information in the Comm100 Agent Console and synchronize data conveniently from Comm100 to Dynamics 365. The integration delivers a consistent customer information management experience and improves your agent efficiency.

Once your Comm100 integration with Dynamics 365 is in place: 

  • Comm100 can transfer customer data to Dynamics 365 automatically as configured
  • Comm100 can recognize existing customers automatically during chat sessions in Agent Console
  • Agents can access customer information from Dynamics 365 in Agent Console
  • Agents can automatically create Contact/Lead/Case/Task when a chat ends, or an offline message is received
  • Agents can manually create a Contact/Lead/Case/Task in the Agent Console
  • Agents can use Dynamics 365 fields to create chat routing rules and visitor segments
  • The chatbot can automatically create, update, or search Dynamics 365 entities

You can also download the Comm100 - Dynamics 365 Integration white paper to learn more about the integration.

Step 1a: Create an Application in Azure Active Directory (for Cloud Users)

Before integrating Comm100 with Dynamics 365, you first need to set up your Application in Azure Active Directory and create an Application User to get Organization URL, Application (client) ID, Application Secret, and Directory (tenant) ID from your application in Azure Active Directory.

To create an Application in Azure Active Directory, follow these steps:

  1. Go to https://admin.microsoft.com and select Azure Active Directory.
  2. When in the Azure Active Directory admin center, select App registrations from the left navigation menu and click New registration.
  3. Enter the Name for your integration, for example, Dynamics 365 Integration for Comm100. Choose the Supported account types for your organization and click Register.
    Note: You can also change the integration name later.
  4. Next, go to the API permissions tab and click Add a permission. You will see several tiles in the Commonly used Microsoft APIs category. Choose Dynamics CRM.
  5. After that, select the user_impersonation permission and click Add permissions.
  6. Click Grant admin consent for your organization, and then click Yes for the confirmation.

    A message appears: Successfully granted admin consent for the requested permissions.
  7. Go to the Overview tab, find and save Application (client) ID and Directory (tenant) ID.
  8. Go to Certificates & secrets and click New client secret.
  9. On the Add a client secret drawer, enter Dynamics 365 Integration for Comm100 in the Description field and choose the expiration period for the client secret.
  10. Click Add.
  11. Save the newly created secret value. You will need it later when setting up the Comm100 Live Chat integration.
  12. At this point, you should have the following information: Application (client) ID, Directory (tenant) ID, and Secret Value.
Step 1b: Create an Application Group in Active Directory Federation Services (ADFS) 2016 or later
(for On-Premises Users)

Before integrating Comm100 with Dynamics 365, you first need to set up your Application Group in ADFS 2016 to get Application (client) ID and Application Secret.

To create an application group in AD FS 2016 or later, follow these steps: 

  1. Open the ADFS Management from your Server Manager.
  2. In the ADFS Management navigation tree, right-click Application Groups and select Add Application Group.
  3. The Add Application Group Wizard window appears.
  4. On the Welcome page: 
    1. In the Name field, type the application group name. For example, ADFSOAUTHCC.
    2. In the Template field, under the Client-Server applications group, select Server application accessing a web API
    3. Click Next.
  5. On the Server application page:
    1. Copy the Client Identifier.
      You'll use the Client Identifier value, which is the Application (Client) ID field in Comm100 Control Panel while setting up the Dynamics 365 connection. It's the value for ida: ClientId
    2. Click Next.
  6. On the Configure Application Credentials page: 
    1. Select the Generate a shared secret checkbox. 
    2. Copy and save the secret.
      You'll use this secret later in Comm100 Control Panel while setting up the Dynamics 365 connection. It's the value for ida: ClientSecret.
      Note: You will not be able to view the secret after the application group is created. You can reset the secret later if required.
    3. Click Next.
  7. On the Configure Web API page:
    1. In the Identifier field, enter the Dynamics 365 on-premises URL with your OData/Dynamics365 version. For example, https://comm100.dynamics365onpremise.com/api/data/v9.0.
      This URL will be used as a "Resource" when requesting an access token.
    2. Click  Add.
    3. Click  Next.
  8. On the Apply Access Control Policy page:
    1. Select  Permit everyone.
    2. Click Next.
  9. On the Configure Application Permissions page:
    1. Select the openid and user_impersonation checkboxes.
    2. Click Next.
  10. On the Summary page, click Next.
  11. On the Complete page, click Close.
    At this point, you should have the following information: Application (client) ID and Application Secret.
  12. Now, right-click the Application Group that you just created and select Properties.
  13. Select ADFSOUTHCC – Web API and click Edit.
  14. Select the Issuance Transform Rules tab and click Add Rule to add three rules.

    The Add Transform Claim Rule Wizard window appears.
  15. On the Choose Rule Type page:
    1. Select the Pass Through or Filter an Incoming Claim template from the Claim rule template drop-down list.
    2. Click Next.
  16. On the Configure Claim Rule page:
    1. In the Claim rule name field, type Pass Through UPN (or something descriptive).
    2. From the Incoming claim type drop-down list, select UPN.
    3. Select the Pass through all claim values option.
    4. Click Finish.
  17. Again, in the ADFSOAUTHCC Web-API properties window, click Add Rule.
  18. On the Choose Rule Type page:
    1. From the Claim rule template drop-down list, select Pass Through or Filter an Incoming Claim.
    2. Click Next.
  19. On the Configure Claim Rule page:
    1. In the Claim rule name field, type Pass Through Primary SID (or something descriptive).
    2. From the Incoming claim type drop-down list, select Primary SID.
    3. Select the Pass through all claim values option.
    4. Click Finish.
  20. Again, in the ADFSOAUTHCC Web-API properties window, click Add Rule.
  21. On the Choose Rule Type page:
    1. From the Claim rule template drop-down list, select Transform an Incoming Claim.
    2. Click Next.
  22. On the Configure Claim Rule page:
    1. In the Claim rule name field, type Transform Windows Account Name to Name (or something descriptive).
    2. From the Incoming claim type drop-down list, select Windows account name.
    3. From the Outgoing claim type drop-down list, select Name.
    4. Select the Pass through all claim values option.
    5. Click Finish.
  23. When you have created all the three rules, click OK to close the ADFSOAUTHCC Web -API properties window.

 

Step 2: Create an application user

To create an application user, follow these steps:

  1. Go to the Power Platform admin center as a System Administrator.
  2. Select Environments, and then select an environment from the list.
  3. Select Settings.
  4. Select Users + permissions, and then select Application users.
  5. Select + New app user to open the Create a new app user page.
    1.png
  6. Select + Add an app to choose the registered Azure AD application that was created for the selected user, and then select Add.
    2.png
  7. The selected Azure AD app is displayed under App. You can select Edit to choose another Azure AD application. 
  8. Under Business Unit, select a business unit from the dropdown list.
    3.png
    You can select for Security roles to choose security roles for the chosen business unit to add to the new application user. You need to assign the security roles to the user. You can create a new security role or assign an existing one to the user. 
  9. To create a new security role, log in to https://admin.microsoft.com, and go to Settings > Security > Security Roles.

    Note: You can skip steps 9 - 14 if you do not need to create a new security role.
  10. Click New.
  11. On the Details tab, enter a role name.
  12. Navigate to Core Records, Service, Business Management, and Customization tabs and assign permissions to the entities.
    Note: Ensure that the application user must have the permission listed in the following table, whether the security role is a new or existing one.

    The following table lists the permissions of the entity for the security role.
    Entity Create  Read Write Delete Append Append To Assign Share
    Core Records         
     AccountNot selectedOrganizationNot selectedNot selectedOrganization Organization  Not selectedNot selected
     ActivityOrganizationOrganizationOrganization Not selectedOrganization Organization  Not selectedNot selected
     ContactOrganizationOrganizationOrganization Not selectedOrganization Organization  Not selected
     LeadOrganizationOrganizationOrganization Not selectedOrganization Organization  Not selectedNot selected
     NoteOrganizationOrganizationNot selectedNot selectedOrganization Organization Not selectedNot selected
    Service        
    CaseOrganizationOrganizationOrganization Not selectedOrganizationOrganization  Not selectedNot selected
    Business Management        
    Team Not selectedOrganizationNot selectedNot selectedOrganization Organization  Not selectedNot selected
    UserNot selectedOrganizationNot selectedNot selectedOrganization Organization  Not selectedNot selected
    Customization
    Attribute MapNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    EntityNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    FieldNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    Plug-in AssemblyNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    Plug-in TypeNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    RelationshipNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    Sdk MessageNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    Sdk Message Processing StepNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    Sdk Message Processing Step ImageNot selectedOrganizationNot selectedNot selectedNot selectedNot selectedNot selectedNot selected
    System JoboOrganizationOrganizationOrganization Organization Organization Organization Organization Organization 
    • For some Case creation, if updating or creating a Case requires the system job, then you need to assign the System Jobs permission to the application user.
  13. To access the organization's data, your newly created user needs specific security roles. Assign the security role to the user. Go to Settings > Security > Users and select the Application user you just created.
  14. Click MANAGE ROLES from the toolbar and select the security role.
Step 3a: Integration with Live Chat

Based on the type of integration, once you have completed Step 1a: Create an Application in Azure Active Directory (for Cloud Users) or Step1b: Create an Application Group in Active Directory Federation Services 2016 or later (for On-Premises Users), and Step 2: Create an application user, you have the following connection details to connect Comm100 Live Chat with Dynamics 365:

  • Dynamics 365 Organization URL
  • Application (Client) ID
  • Directory (tenant) ID
  • Application Secret 

Note: 

  • Your agents must have the correct permissions to manage the Dynamics 365 integration with Comm100 Live Chat.
  • Comm100 integration works with Microsoft Dynamics 365 version 9.0 or above.

To connect with Dynamics 365, follow these steps:

  1. Log in to your Comm100 Control Panel.
  2. From the left navigation menu, click Apps & Integrations > Microsoft Dynamics 365.
  3. Click Settings.
  4. Once the Dynamics 365 App is enabled, provide the following connection details, and click Save:
    • For Cloud integration, select the For Dynamics 365 Cloud tab and provide the following details:
      • Dynamics 365 Organization URL:Your organization URL, usually in the form of: https://[your_org].crm[x].dynamics.com. For example, https://fce98293423.crm3.dynamics.com.
      • Application (Client) ID: The ID of the application registered at the Azure Active Directory for authentication and authorization.
      • Directory (tenant) ID: The Tenant ID of Azure Active Directory where the application resides. 
      • Application Secret: A secret, referred to as an application password, is a string that the application uses to prove its identity.
    • For On-premises integration, select the For Dynamics 365 On-premises tab and provide the following details:
      • Dynamics 365 Organization URL: Your organization URL for Dynamics CRM on-premises instances. The URL is defined by a client administrator when setting up their Dynamics 365 Server.
        Note: Comm100 recommends using on-premises version 9.x or later for integration, however, if you are using the version older than 9.x, then you need to add the /api/data/vx.x after the Organization URL. Where vx.x is the version number of on-premises, For example, your Organizational URL should look like
      • Login Email: Login email of your Dynamics 365 user account to perform the integration.
      • Password: Password of your Dynamics 365 user account to establish a connection.
      • Application (Client) ID: The identifier of the application registered with the ADFS server for authentication and authorization.
      • Application Secret: A secret from the ADFS when you Configure Application Credentials is a string that the application uses to prove its identity.
      • Authority URL: The URL of your ADFS service. For example, https://fs.anandmsft.com/adfs/oauth2/token.

         

Record Live Chat Data in Dynamics 365 Manually

If you want to create Lead, Contact, Case, or Task manually when a chat is ended, you need to select the Manually create Lead/Contact/Case/Task in Agent Console option from the Dynamics 365 page.

On the Dynamics tab of your Comm100 Agent Console, click on the action you want to perform, and the corresponding data will be recorded in your Dynamics 365 account.

 

Record Live Chat Data in Dynamics 365 Automatically

If you want to create Lead, Contact, Case, or Task automatically, you can select the Automatically option and choose an action from the drop-down list to record these data when a chat ends or an Offline Message is received:

  • Create/Update Contact & Add Case: If no matching Contact is found from the existing Contacts in your Dynamics 365 account, a new Contact will be created for each visitor. If a matching Contact is found, you can choose how to update the Contact and add a Case for each chat/offline message of the visitor.
  • Create/Update Contact & Add Task: If no matching Contact is found from the existing Contacts in your Dynamics 365 account, a new Contact will be created for each visitor. If a matching Contact is found, you can choose how to update the Contact and add a Task for each chat/offline message of the visitor.
  • Create/Update Contact: If no matching Contact is found from the existing Contacts in your Dynamics 365 account, a new Contact will be created for each visitor. If a matching Contact is found, you can choose how to update Contact.
  • Create/Update Lead & Add Task: If no matching Lead is found from the existing Leads in your Dynamics 365 account, a new Lead will be created for each visitor. If a matching lead is found, you can view/update the Lead, and add a Task for each chat/offline message of the visitor.
  • Do Nothing: If you choose this option, no entities are created or updated when a chat ends or an offline message is submitted. If a Contact or Lead is found, the Dynamics 365 icon will display under the visitor’s name, however, without the Dynamics 365 tab in the Agent Console.

 

Update Contact Information

When you choose to create records in the Dynamics 365 system automatically, you can choose what action should be taken when a matching contact is found:

  • Do not update the Contact. Contact will not be updated when a chat ends or an offline message is submitted.
  • Update the Contact with information from live chat. Retrieve all fields under this Contact, and then reassign values from live chat to all these Contact fields. The value is collected from the live chat based on configured field mapping rules.
  • Only add new information (Do not overwrite existing information). Retrieve all fields under this Contact, and then assign values to blank fields with information collected from the live chat based on configured field mapping rules.

Entity Field Mapping and Display in Comm100

You can configure the mapping of the field between Dynamics 365 Contact, Lead, Task, and Case fields with Comm100 Live Chat fields so that you can automatically save the value from specified live chat fields to Dynamics 365 contacts fields when creating or updating a contact, lead, case or task respectively. 

The following table list the default field mapping for the Contact, Case, Lead, and Task entities.

Entities

Dynamics 365 Fields 

Comm100 Fields

Contact

Last Name

Visitor Name

Email

Visitor Email

Business Phone 

Pre-chat Phone

Lead

Last Name

Visitor Name

Business Phone 

Pre-chat Phone

Email

Visitor Email

Company Name

Pre-chat Company

Case

Description

Transcript

Task

Description

Transcript

To map fields for the Contact, Case, Lead, and Task entities, follow these steps:

  1. On the Entity Field Mapping and Display in Comm100 section, select an entity from the drop-down list.
    A table appears with the list of the Dynamic 365 fields of the selected entity.
  2. From the Comm100 Field column, map the corresponding Comm100 field from the drop-down list.
  3. In case you want to display a field in the Agent Console, enable the toggle key.
  4. Click Save.

Customize Rules to Identify the Dynamics 365 Account, Contact, and Lead

You can configure your own rules to identify the Contact, Lead, and Account. If multiple Dynamics 365 entities are found via an identification rule, Comm100 displays only the first entity in the Comm100 Agent Console.

If no account identification rule is met, Comm100 displays the Contact associated with Account details or does not show any account details if the Contact does not have an associated account.

If there is a mapped account according to the identification rule, Comm100 displays the account details.

 

Configure the Live Chat routing rules with fields from Dynamics 365 Account or Contact

After successfully connecting Dynamics 365 to the Comm100 site, you can configure the Live Chat routing rules with Dynamics 365 Account or Contact fields. Once the conditions are triggered, the specified Dynamics 365 Account or Contact will be routed to the target agent or department as you predefined.

 

Configure Visitor Segmentation with fields from Dynamics 365 Account or Contact

After successfully connecting Dynamics 365 to the Comm100 site, you can configure the visitor segmentation with fields from Dynamics 365 Account or Contact. You can create conditions so that agents can view the segment the visitor belongs to in the Agent Console if a visitor meets these for a segment. To learn more on Visitor Segmentation and how to set it up, see this article.

Note: Dynamics 365 Account or Contact in the Condition will be removed if the Dynamics 365 integration is disconnected.

 

Disconnect Comm100 from Dynamics 365 

Your agent with the permissions can disconnect Comm100 from Microsoft Dynamics 365 if you no longer need it. You can click the Disconnect link icon beside the Connected Organization Account, select the check box and click OK to confirm the disconnection.

Note: Once Comm100 is disconnected with Dynamics 365, you can reconnect with the valid connection settings. 

 

Manage Integration Error 

If your agents do not have the correct permissions to manage the Dynamics 365 integration with Comm100 Live Chat, Comm100 shows the following error message: You need permission for "Manage Integration” to access this part.

Note: The Dynamics 365 integration is available in the Business edition or above. If you would like to open this feature, you can contact the Comm100 Sales team to get it enabled.

Step 3b: Integration with Chatbot

After integrating Dynamics 365 with Comm100, you can create a new system or custom objects (lead/case/contact/task) in Dynamics 365 through Chatbot. If a record already exists in Dynamics 365, you can either choose to abort the creation or force create a duplicate record. Further, you can even search a record by performing an advanced search using the FetchXML statement in case you cannot locate the record by the field you are searching for.

You can go to the Bot > Chatbot navigation menu and configure your Chatbot from the Intent-Answer or Event Messages flow builder or both. 

kb_chatbotd365_01.png

If your account is not added to Dynamics 365 or it is disconnected from Dynamics 365, you will see a warning message on the Dynamics 365 actions. You need to first connect your Dynamics 365 account before configuring the actions.

kb_chatbotd365_05.png

The flow builder contains the following Dynamics 365 actions that allow your Chatbot to send records to Dynamics 365 or receive records from Dynamics 365 or both:

  • Create a record
  • Find a record
  • Find a record by FetchXML

Create a record

The Create a record action gives you the ability to create a record to Dynamics 365 across the Live Chat and Ticketing & Messaging channels. The information collected is saved into record fields in Dynamics 365. A record ID is created and saved to a variable.

The Define Record Information drawer appears when you click + Define record information on the action. You need to first select an entity from the Dynamics 365 entity drop-down list. The drop-down list contains all the available Dynamics 365 entities for a given account.

After that, you will see a list of mandatory Dynamics 365 fields based on the entity you had chosen, where you can input string and Dynamic Info as a field value.

Note: You can also add non-required fields as per your business needs.

If the record you want to create already exists in Dynamics 365, you can either choose Do not create a record to abort the creation or choose to Create a duplicate record to force create a duplicate record.

kb_chatbotd365_02.png

Once the action is triggered, the Chatbot will use the values to create a record into Dynamics 365 and save the returned record ID into the pre-defined variable, which can be used in the follow-up actions. 

Note: You can save the return record to a variable either using existing Bot variables or creating a new variable.


Find a record

The Find a record action gives you the ability to find a record in Dynamics 365 by a field value. You can then save the field values of the found record into bot variables so that you can use them later in the flow.

The Define Search Rule drawer appears when you click + Define search rule on the action. You need to select an entity from the Dynamics 365 entity drop-down list followed by a field name from the Field to search by drop-down list and provide a field value in the Search value text field. You can also insert Dynamic Info as a search value to find the records. You can configure multiple fields and assign each field value to a bot variable.

Note: If multiple records exist during the search, only the first record from the record list is considered.

kb_chatbotd365_03.png

Once the action is triggered, the Chatbot will use the pre-defined field to find the record in Dynamics 365. When Dynamics 365 returns the matched record, the Chatbot will save its Dynamics 365 field value to the pre-defined bot variable and trigger the action based on your configuration. A different action can be configured when there is no matched record in Dynamics 365.


Find a record by FetchXML

The Find a record by FetchXML action gives you the ability to write the advanced search statement to find records in Dynamics 365 in the Intent-Answer or Event Messages flow builder across the Live Chat and Ticketing & Messaging channels. This action can be used where you do not get the desired results from the Find a record action. To learn more about using FetchXML to construct a query, see this page

Note: FetchXML is a proprietary XML-based query language of Microsoft Dataverse used to query data using either the Web API or the Organization service.

 In the following example, the FetchXML statement retrieves all accounts where the last name of the owning user is not equal to Cannon:

kb_chatbotd365_06.png


The Define FetchXML Search Rule drawer appears when you click + Define FetchXML search rule on the action. You need to select the Dynamics 365 entityand enter the FetchXML statement to search for the records from Dynamics 365. You can also insert Dynamic Info in the FetchXML statement to find the records. 


Note:  If multiple records exist during the search, only the first record from the record list is considered.

kb_chatbotd365_04.png

Once the action is triggered, the Chatbot will use the pre-defined field to find the record in Dynamics 365. When Dynamics 365 returns the matched record, the Chatbot will save its Dynamics 365 field value to the pre-defined bot variable and trigger the action based on your configuration. A different action can be configured when there is no matched record in Dynamics 365.