30 Jul

AI-Based Lead Scanner in Dynamics 365 with Power Automate & AI Builder

Checking and validating hundreds of incoming leads every day is a massive headache for sales teams. With leads coming from multiple sources—such as contact forms, inbound emails, and third-party integrations—your Dynamics 365 system can quickly become cluttered with fake emails, test submissions, and outright spam. Reps end up wasting precious hours sifting through garbage data instead of engaging with genuine prospects.

What if you could automatically validate every incoming lead, assess its authenticity, and boost your lead score in real time using native Power Platform tools?

Here is a step-by-step guide on how to build an automated AI-Based Lead Scanner for Dynamics 365 Sales and Marketing using Power Automate and AI Builder Prompts.

Solution Architecture Overview

The solution relies entirely on native, low-code Power Platform features:

  1. Trigger: A new Lead record is created in Dataverse/Dynamics 365 (via Web, Email, or API integration).

  2. AI Analysis: Power Automate calls a custom AI Builder Prompt, passing four key attributes: Email, Phone Number, Address, and Description.

  3. Structured Validation: AI analyzes the lead data for syntax, disposable domains, and logical consistency (e.g., matching area code formats to physical address locations).

  4. Actionable Output: AI returns a structured JSON payload with individual check results and a confidence score.

  5. Automated Lead Scoring: Dynamics 365 processes the output to auto-update custom lead fields, increment lead scores, or archive spam automatically.

Step 1: Create the AI Builder Custom Prompt

In the Power Apps portal, navigate to AI Hub > Prompts and create a new custom prompt.

Get started with prompt library – Microsoft Copilot Studio | Microsoft Learn

Inputs

Define four parameters:

  • EmailAddress

  • PhoneNumber

  • Address

  • Description

Prompt Definition & System Instructions

Copy and paste the following prompt configuration into AI Builder:

You are an expert sales lead auditor and data validation assistant. Analyze the provided lead information to determine if the lead is genuine or spam.

Lead Details:

  • Email: {EmailAddress}

  • Phone: {PhoneNumber}

  • Address: {Address}

  • Description: {Description}

Analysis Guidelines:

  1. Check if the email address syntax is valid and whether it looks like a temporary/disposable domain or spam pattern (e.g., test12345@asdf.com).

  2. Check if the phone number is valid and if its country/area code logically aligns with the provided address location.

  3. Verify if the street address appears to be a real, plausible address structure.

  4. Evaluate the description for coherent buyer intent versus generic spam, gibberish, or promotional links.

Output Requirement:

Respond strictly in valid JSON format using the exact schema below. Do not include markdown code block wrappers (like “`json).

{

“classification”: “Genuine” or “Spam”,

“confidence_score”: 1 to 10,

“reasoning”: “A brief one-sentence explanation of why it was classified this way.”,

“address”: {

“IsValid”: true or false,

“IsGenuine”: true or false,

“reasoning”: “A brief one-sentence explanation regarding the address check.”

},

“EmailAddress”: {

“IsValid”: true or false,

“IsGenuine”: true or false,

“reasoning”: “A brief one-sentence explanation regarding the email check outcome.”

},

“PhoneNumber”: {

“IsValid”: true or false,

“IsGenuine”: true or false,

“reasoning”: “A brief one-sentence explanation regarding phone validation and location alignment.”

}

}

JSON output – Microsoft Copilot Studio | Microsoft Learn

Step 2: Build the Power Automate Flow

Once your AI Prompt is saved and tested, create an automated cloud flow:

1. Trigger

  • Connector: Microsoft Dataverse

  • Trigger Name: When a row is added, modified, or deleted

  • Change type: Added

  • Table name: Leads

  • Scope: Organization

2. Run the AI Prompt Action

  • Add the Create text with GPT using your prompt action.

  • Select the prompt created in Step 1.

  • Map the Lead parameters from the Dataverse trigger:

    • EmailAddress $\rightarrow$ Primary Email

    • PhoneNumber $\rightarrow$ Business Phone / Mobile Phone

    • Address $\rightarrow$ Concatenated fields (Street 1, City, Postal Code, Country)

    • Description $\rightarrow$ Description

3. Parse the JSON Output

  • Add a Parse JSON action.

  • Pass the raw text output from the AI Builder action into the content field.

  • Provide the JSON schema (matching your prompt structure) so Power Automate can parse individual output attributes.

4. Update the Dataverse Lead Record

  • Add an Update a row Dataverse action target on the Leads table.

  • Store key returned values in custom Lead attributes:

    • AI Classification (Genuine / Spam)

    • AI Confidence Score (1–10)

    • AI Validation Summary

Step 3: Configure Dynamics 365 Lead Scoring Rules

With structured AI validation metrics written back to the lead record, you can build native Dynamics 365 Lead Scoring Rules or automated routing conditions.

Sample Scoring Logic

Data Point & Condition Score Adjustment
Classification = “Genuine” +20 Points
Email IsValid & IsGenuine = True +10 Points
Phone IsValid & IsGenuine = True +10 Points
Address IsValid & IsGenuine = True +10 Points
Confidence Score $\ge$ 8 +10 Points
Classification = “Spam” -50 Points(Auto-Disqualify)

Example of Lead Scoring model:

Business Impact & Key Benefits

Implementing an AI-based lead scanner provides immediate business ROI:

  • Save Sales Hours: Sales representatives stop chasing bogus contacts and dead phone numbers.

  • Faster Response Times: High-value, verified leads are prioritized instantly for direct rep engagement.

  • Protect Domain Reputation: Prevent automated email marketing journeys from triggering against hard-bounce and disposable email traps.

  • Pure Low-Code: Native Power Platform implementation without managing external API integrations or paying for third-party plug-ins.

Posted by | Posted at 30/07/2026 11:09 pm |
Power Platform, Dynamics 365 CE, Customer service, Field Service, Sales, Marketing, Portal and Azure. | UK SC Cleared | UK and USA

Leave a Reply


About Us

We are Microsoft Partner that specialized in Dynamics 365 and Microsoft Power Platform.

With a combination of Power Platform, Dynamics 365, Azure, SharePoint and SQL Server, we create the solutions that improve productivity, profitability, and customer service.


Contact Us

    Associations

    G-Cloud Supplier


    Copyright © 2020 by XRM Technology Ltd  |   Privacy Policy   |   Terms of Use   |   Registration number: 07355210   |   VAT: 102455946  

    Discover more from xRM Technologies

    Subscribe now to keep reading and get access to the full archive.

    Continue reading