Track Email Message Exchanges Between Salespeople and Contacts

Note

Azure Active Directory is now Microsoft Entra ID. Learn more

Get more out of the communications between your salespeople and customers by turning email exchanges into actionable opportunities. Business Central can work with Exchange Online to keep a log of the inbound and outbound messages. You can view and analyze the contents of each message on the Interaction Log Entries page.

Important

For Business Central online, Business Central and Exchange Online must be on the same tenant.

To set up email logging

Set up public folders and rules for email logging in Exchange Online

Note

The following sections assume that you have administrator access for Exchange Online.

Before you can set up email logging, you must prepare Office 365 public folders. You can do this in the Exchange admin center, or you can use the Exchange Online PowerShell.

Tip

If you want to use the Exchange Online PowerShell, you can find inspiration for how to set up your script in a sample script that we published in the BCTech repo.

Follow the steps below to set up Exchange Online, with links to where you can learn more.

Create an admin role group

Create an admin role group for public folders based on the information in the following table:

Property Value
Name Public Folders Management
Selected roles Public Folders
Selected users The email of the user account that Business Central will use to run the email logging job

For more information, see Manage role groups in Exchange Online.

Create a new public folder mailbox

Create a new public folder mailbox based on the information in the following table:

Property Value
Name Public MailBox

For more information, see Create a public folder mailbox.

Create new public folders

  1. Create a new public folder with the name Email Logging in the root so that the full path to the folder becomes \Email Logging\.

  2. Create two sub-folders so that the the result is the following full paths to the folders:

    • \Email Logging\Queue\
    • \Email Logging\Storage\

For more information, see Create a public folder.

Set public folder ownership

Set the email logging user as an owner of both public folders, Queue and Storage.

For more information, see Assign permissions to the public folder.

Mail-enable the Queue public folder

For more information, see Mail-enable or mail-disable a public folder.

Mail-enable sending emails to the Queue public folder

Mail-enable sending emails to the Queue public folder using Outlook or the Exchange Management Shell.

For more information, see Allow anonymous users to send email to a mail-enabled public folder.

Create mail flow rules

Create two mail flow rules based on the information in the following table:

Purpose Name Apply this rule if... Do the following...
A rule for incoming email Log Email Sent to This Organization The sender is located Outside the organization, and the recipient is located Inside the organization BCC the email account that is specified for the Queue public folder
A rule for outgoing email Log Email Sent from This Organization The sender is located Inside the organization, and the recipient is located Outside the organization BCC the email account that is specified for the Queue public folder

For more information, see Manage mail flow rules in Exchange Online and Mail flow rule actions in Exchange Online.

Note

If you make changes in the Exchange Management Shell, the changes become visible in the Exchange admin center after a delay. Also, the changes made in Exchange will be available in Business Central after a delay. The delay might be several hours.

Next, you connect Business Central with Exchange Online.

Set Up a shared mailbox and rules for email logging in Exchange Online

Note

These steps require administrator access for Exchange Online.

Prepare a shared mailbox in the Exchange admin center. Alternatively, you can also use Exchange Online PowerShell. For more information, see Create a shared mailbox or Exchange Online PowerShell.

Note

If you use Exchange Management PowerShell, your changes are available in the Exchange admin center after a delay. The delay might be several hours.

Add a user account for members of the shared mailbox

The account that you use for email logging is an Exchange Online account. The scheduled job uses the account to connect to the shared mailbox and process emails. This account shouldn't be associated with a specific person. Add the email account to the members for the shared mailbox. For more information, see Use the EAC to edit shared mailbox delegation.

Allow other users to see logged emails

You can allow another user to open an email message in Exchange that is related to an interaction log entry from Business Central. To do that, give the user Read permission to the Archive folder in the shared mailbox. For more information, see Exchange Online PowerShell.

Create mail flow rules

Mail flow rules look for specific conditions on messages and take action on them. Create two mail flow rules based on the information in the following table. For more information, see Manage mail flow rules in Exchange Online and Mail flow rule actions in Exchange Online.

Purpose Name Apply this rule if... Do the following...
A rule for incoming email Log Email Sent to This Organization The sender is located outside the organization, and the recipient is located inside the organization BCC the email account that is specified for the shared mailbox.
A rule for outgoing email Log Email Sent from This Organization The sender is located inside the organization, and the recipient is located outside the organization. BCC the email account that is specified for the shared mailbox.

Note

Business Central only processes messages in the Inbox folder in the shared mailbox. If a rule moves messages from the Inbox to another folder, those messages will not be processed. Additionally, messages in the Junk Mails folder are also ignored.

Set Up Business Central to log email messages

Get started with email logging in two easy steps:

  1. Connect Business Central with Exchange Online for your Microsoft 365 subscription. Exchange Online handles your email messages. We made this step easy by providing an assisted setup guide. You just need your administrator credentials for your administrator account in Microsoft 365. To start the guide, go to the Assisted Setup page, and then select the Set up email logging guide.

  2. Make sure that the email addresses for your sales people and contacts in Business Central are valid. To do that, for each customer or salesperson, open the Contact or Salesperson/Purchaser card and have a look in the Email field.

    Tip

    After you complete the steps in the guide you can check whether the connection was successful. Search for Email Logging, choose Actions, and then choose Validate Setup.

View email message exchanges in the Interaction Log

Business Central creates an entry on the Interaction Log page each time a salesperson and a contact exchange an email message. To view the interaction log, open the Contact card for the person, choose Related, then History, and then Interaction Log Entries. There are a few things you can do with each entry in the log, for example:

  • View the content of the email message that was exchanged by selecting Process and then Show Attachments.
  • Turn an email exchange into a sales opportunity. If an entry looks promising, you can turn it into an opportunity and then manage its progress toward a sale. To turn an email exchange into an opportunity, choose the entry, then Process, and then Create Opportunity. For more information, see Managing Sales Opportunities.

Mailbox and folder limits in Exchange Online

There are mailbox and folder limits in Exchange Online, such as limits for folder sizes and the number of messages. For more information, see Exchange Online limits and Limits for public folders in Exchange Server.

Business Central stores logged email messages in a folder in Exchange Online. Business Central also stores a link to each logged message. The links open the logged messages in Exchange Online from the Interaction Log Entries, Contact Card, and Salespersons Card pages in Business Central. If a logged message is moved to another folder, the link is broken. For example, a message might be moved manually, or Exchange Online might automatically start AutoSplit when a storage limit is reached.

The following steps can help you avoid breaking links to messages in Exchange Online.

  1. Don't move existing messages to another folder after you change settings for your email logging setup. Keeping existing messages put preserves the links. Links to messages in the new folder are valid.
  2. Avoid reaching the mailbox and folder limits. If you're about to reach a limit, take the following steps:
    1. Set up a new shared mailbox in Exchange Online.
    2. Update your email flow rules in Exchange Online.
    3. Update your email logging setup in Business Central accordingly

Connect on-premises versions to Microsoft Exchange

You can connect Business Central on-premises to Exchange on-premises or Exchange Online for email logging. For both versions of Exchange, settings for the connection are available on the Marketing Setup page. For Exchange Online, you can also use an assisted setup guide.

Connect to Exchange Online

To connect to Exchange Online, you must register an application in Microsoft Entra ID. Provide the application ID, key vault secret, and the redirect URL to use for the registration. The redirect URL is preset and should work for most installations. For more information, see To register an application in Microsoft Entra ID for connecting from Business Central to Exchange Online.

You must also use OAuth2 as the Authentication Type. You must also register an application in Microsoft Entra ID. Provide the application ID, key vault secret, and the redirect URL to use for the registration. The redirect URL is prepopulated and should work for most installations. For more information, see To register an application in Microsoft Entra ID for connecting from Business Central to Exchange Online.

You must set up your installation to use HTTPS. For more information, see Configuring SSL to Secure the Business Central Web Client Connection. If you're setting up your server to have a different home page, you can change the URL. The client secret is saved as an encrypted string in your database.

To register an application in Microsoft Entra ID for connecting from Business Central to Exchange Online

The following steps assume that you use Microsoft Entra ID to manage identities and access. For more information, see Quickstart: Register an application with the Microsoft identity platform.

  1. In the Azure portal, under Manage, choose Authentication.

  2. Under Redirect URL, add the redirect URL that is suggested on the Email Logging page in Business Central. If the redirect URL field on the Email Logging page is empty, find the suggested redirect URL on the Assisted Setup page. To open the page, on the Email Logging page, choose Actions, and then Assisted Setup.

    Note

    If you do not specify the redirect URL, you can do so later by choosing Add a platform, and then choosing Web to add the web application and the redirect URL.

  3. Under Manage, choose API permissions, and choose Microsoft Graph, and then choose Delegated permissions.

  4. Use the search box to find and select Mail, and then add the Mail.ReadWrite.Shared permission.

  5. Under Manage, choose Certificates & Secrets, and then create a new secret for your app. You use the secret either in the Client Secret field on the Email Logging page in Business Central.

  6. Choose Overview, and then find the Application (client) ID value. This value is the client ID of your application. You must enter it either in the Client ID field on the Email Logging page.

  7. In Business Central, set up email logging on the Email Logging page, or use the Assisted Setup guide for assistance.

Use Another Identity and Access Management Service

If you aren't using Microsoft Entra ID to manage identities and access, you need some help from a developer. If you prefer to store the app ID and secret in a different location, you can leave the Client ID and Client Secret fields blank and write an extension to fetch the ID and secret from the location. You can provide the secret at runtime by subscribing to the OnGetEmailLoggingClientId and OnGetEmailLoggingClientSecret events in codeunit 1641 "Setup Email Logging."

To start logging email

  1. To start logging email, on the Email Logging page, turn on the Enabled toggle.

  2. Sign in with the Exchange Online account that the scheduled job uses to connect to the shared mailbox and process emails.

    Note

    If you are not prompted to sign in the the Exchange Online account, it might be because your browser is blocking pop-ups. To sign in, allow pop-ups from https://login.microsoftonline.com.

To stop logging email

  1. Choose the Lightbulb that opens the Tell Me feature. icon, enter Email Logging, and then choose the related link.
  2. Turn off the Enabled toggle.

To change the user account used for email logging

Business Central Online

  1. Sign in to Business Central with the account that the scheduled job uses to connect to the shared mailbox and process emails. This account must have access to both Business Central and Exchange Online.
  2. Choose the Lightbulb that opens the Tell Me feature. icon, enter Email Logging, and then choose the related link.
  3. Choose Related, and then Job Queue Entry.
  4. Restart the Email Logging job.

Business Central on-premises

  1. Choose the Lightbulb that opens the Tell Me feature. icon, enter Email Logging, and then choose the related link.
  2. Choose Actions, and then Renew Token.
  3. Sign in with the Exchange Online account that the scheduled job uses to connect to the shared mailbox and process emails.

See also

Managing Relationships

Find free e-learning modules for Business Central here