Skip to main content

Microsoft Dynamics 365 integration

Send quiz takers to Dynamics 365 Sales as leads, or update their contact, with their answers and a completed quiz task on their timeline.

Written by Traian

With the Microsoft Dynamics 365 integration, quiz takers who leave their email are added to Dynamics 365 Sales as leads, or update their contact if they're already a customer of yours. Each completion also adds a completed task to their timeline with their answers, their recommended products and a link to their results, so your team sees what every customer told the quiz.

The integration works with Dynamics 365 Sales. Setting it up takes a few minutes in two Microsoft admin pages, so you'll need to be an admin in Microsoft Entra and in the Power Platform admin center, or ask your IT team to do steps 1 and 2 for you.

Step 1: Register an app for Lantern in Microsoft Entra

Dynamics 365 doesn't use API keys. Instead, you register a small app in Microsoft Entra, your company's Microsoft sign-in directory, and Lantern connects as that app. No one has to stay signed in, and the connection keeps working when people join or leave your team.

1.1 Go to entra.microsoft.com and sign in with your work account. Open Entra ID, then App registrations, and click New registration.

1.2 Fill in the form:

  • Name: a name you'll recognize, like Lantern.

  • Supported account types: Single tenant only (in some versions it's called Accounts in this organizational directory only).

  • Redirect URI: leave it empty.

Click Register.

1.3 On the app's Overview page, copy the Application (client) ID and the Directory (tenant) ID. Leave the Object ID, Lantern doesn't need it.

1.4 Open Certificates & secrets, click New client secret, add a description like Lantern and click Add. Copy the secret's Value right away: Microsoft shows it only once. Don't copy the Secret ID next to it, Lantern needs the Value.

You don't need to add anything under API permissions. Dynamics 365 gives the app its access in step 2.

Step 2: Add the app to your Dynamics 365 environment

2.1 Go to the Power Platform admin center, open Manage, then Environments, and click the environment you use for Dynamics 365 Sales. Copy its Environment URL from the Details card. It looks like yourcompany.crm.dynamics.com.

2.2 On the same page, open Settings, then Users + permissions, then Application users. Click New app user, then Add an app, pick the app from step 1 and click Add.

2.3 Choose your Business unit (most companies have one), then click the pencil next to Security roles and pick Salesperson. That role lets Lantern create leads and tasks and update leads and contacts, which is all it needs. Click Create.

Step 3: Connect Dynamics 365 in Lantern

3.1 In Lantern, open Integrations, find Microsoft Dynamics 365 under Marketing and click Connect.

Image showing the Microsoft Dynamics 365 card on Lantern's Integrations page with the Connect button.

3.2 Fill in the window:

  • Environment URL: the address from step 2.1, like yourcompany.crm.dynamics.com. You can also paste the address from your browser's address bar while you're in the Sales app, and Lantern keeps only the part it needs.

  • Directory (tenant) ID and Application (client) ID: the two IDs from step 1.3.

  • Client secret: the Value from step 1.4.

Image showing the Microsoft Dynamics 365 window in Lantern with the Environment URL, Directory (tenant) ID, Application (client) ID and Client secret fields filled in.

3.3 Click Connect. Lantern checks each step with Microsoft and Dynamics 365, and the card shows Connected. If a step is missing, the window says which one, for example an app that wasn't added to the environment in step 2.

Image showing the Microsoft Dynamics 365 card on Lantern's Integrations page with the Connected badge and the Edit button.

Once connected, every active quiz in your store sends quiz takers to Dynamics 365, with no settings to change per quiz.

What Dynamics 365 receives

When a customer completes a quiz and leaves their email, either on the Optin Page or in the Email sign-up on the Results page, Lantern looks the email up in Dynamics 365:

  • If an active contact has that email, Lantern updates the contact.

  • If not, but an open lead has it, Lantern updates the lead.

  • Otherwise, Lantern creates a new lead with the email, the name and mobile phone from the Optin Page, the Topic Lantern quiz: followed by the quiz name, and the Lead Source Web.

Dynamics 365 requires a Last Name on every lead. When the quiz doesn't ask for one, Lantern writes [not provided]. If the customer takes the quiz again with their last name, the real name replaces the placeholder. Lantern never creates contacts and never qualifies leads.

Every completion also adds a completed task to the lead or contact, called Completed Lantern quiz followed by the quiz name. It lists every question with the customer's answer, the products the quiz recommended and a link to their results page. You'll find it in the record's Timeline. A customer who takes the quiz twice gets two tasks, one per completion. A task holds up to 2,000 characters, so on a very long quiz the last answers are cut from the task.

New leads and tasks are owned by the app user from step 2, which Dynamics 365 shows as # Lantern. To give new leads to your sales team, use an assignment rule or a Power Automate flow that changes the owner.

Saving answers in Dynamics 365 columns

The task holds every answer with no setup. If you'd also like answers in their own columns, for views, charts or flows, create the columns in Dynamics 365. Lantern fills columns that exist and never creates columns in your Dynamics 365.

Lantern matches columns by Question Property ID, a short name for a question's answer that you set in the question's right-hand panel in the quiz editor. You can read more about Property IDs in How to use customer answers in Lantern quizzes. A question with the Property ID skin_type fills the column whose display name is Skin Type or skin_type. Capital letters, spaces and punctuation don't matter. Dynamics 365's own columns match the same way, so a question with the Property ID city fills the lead's City.

To create a column:

  • Go to make.powerapps.com, check that your Dynamics 365 environment is selected at the top right, open Tables, then Lead, and click New, then Column.

  • Use the Property ID as the Display name.

  • Pick a type. Single line of text takes any answer. A Choice or Choices column only takes answers that match one of its options exactly, and a multiple choice answer fills a Choices column with each answer as its own option. Whole number, Decimal, Currency and Yes/No columns only take answers that fit them.

  • Create the same column on the Contact table if you'd like answers saved for people who are already contacts.

When Dynamics 365 refuses a value, Lantern saves the record without that answer and keeps the rest. The answer is still in the task.

Lantern also fills these columns when you create them, with exactly these display names:

  • Lantern Quiz (Single line of text): the URL handle of the quiz they took, for example skin-care-finder.

  • Lantern Results URL (Single line of text, format URL): a link to their results page, so your emails can send them back to their recommendations.

  • Lantern Recommended Products (Multiple lines of text): the names of the products on their results page, separated by commas.

  • Lantern Completed At (Date and time): when they completed the quiz. It changes every time, so a flow can run again when a customer retakes the quiz.

Sending follow-up emails

Dynamics 365 sends follow-up emails through Power Automate or through Dynamics 365 Customer Insights - Journeys, if your company has it. A few ways to start one from the quiz:

  • New leads: start a Power Automate flow with the Dataverse trigger When a row is added, modified or deleted on Leads, filtered to Topics that start with Lantern quiz.

  • Every completion: start it when a task with the subject Completed Lantern quiz is added, or when Lantern Completed At changes, so contacts and returning customers are included too.

  • Customer Insights - Journeys: start a journey on the same Dataverse events.

Inside the flow, add conditions on the answer columns to send each customer the email that fits their answers. Take the quiz once yourself with your own email to see a lead arrive before you build the flow.

Marketing consent

Lantern only sends customers who can be emailed:

  • A lead or contact is sent when the customer left an email and Subscribe to email marketing is on for the quiz.

  • Nothing is sent when the customer declined marketing. If your Optin Page shows an optional consent checkbox and the customer leaves it unticked, they aren't sent.

  • Nothing is sent for a customer who left only a phone number, because Lantern finds leads and contacts by email.

The switch is on the Optin Page: open Integration Settings on the right-hand side. It's on by default, and the section appears once Dynamics 365 is connected. Lantern never changes Do not allow Emails, Bulk Emails or any other consent setting in Dynamics 365. To set up the Optin Page and its consent checkbox, see Collect customer emails.

Disconnecting and troubleshooting

To disconnect, open Integrations, click Edit on the Microsoft Dynamics 365 card and click Disconnect. Lantern stops sending customers. Your leads, contacts and tasks stay in Dynamics 365.

To change a value, click Edit on the card. The window asks for the two IDs and the client secret again with every change, because Lantern never shows them back.

If Lantern won't save, the window names the problem:

  • No Microsoft tenant with this Directory (tenant) ID or No app with this Application (client) ID in that tenant: copy both IDs again from step 1.3.

  • Invalid client secret: paste the secret's Value, not its Secret ID: copy the Value again from step 1.4. If you didn't save it, create a new client secret.

  • This client secret has expired: create a new client secret as in step 1.4 and paste its Value.

  • Add the app to this environment as an application user: repeat step 2.2, in the environment whose URL you pasted.

  • Give the app's application user a security role: repeat step 2.3.

  • Could not reach your address: copy the Environment URL again from step 2.1.

Client secrets expire. Microsoft lets you choose how long they last, up to 2 years. When a secret runs out, customers stop arriving in Dynamics 365 until you create a new client secret, paste its Value on the Lantern card and click Update. Set a reminder for the expiry date shown under Certificates & secrets.

Good to know

  • Sensitive answers are not shared. Answers to questions set to Don't share or Don't store are never sent to Dynamics 365, in columns or in the task. See How Sensitive Data Controls Work.

  • Test submissions are included. Completing the quiz in Preview with an email adds that person to Dynamics 365 too.

  • Business Central isn't supported. This integration is for Dynamics 365 Sales, where leads and contacts live.

  • Zapier still works. If you'd rather build your own automation, the Zapier integration can also send quiz takers to Dynamics 365.

Did this answer your question?