Microsoft Dynamics 365 & Dataverse
Advanced Form Integration (AFI) connects your WordPress forms to the Microsoft Dynamics 365 family. One shared connection powers six platforms in AFI: Dynamics 365 CRM, Sales, Marketing, Customer Service, Field Service, and a generic Dataverse connector that can write to any table. Typical uses: a quote request form creates a Lead in CRM, a support form opens a Case in Customer Service, and a service request form creates a Work Order in Field Service.
Supported Features
- Dynamics 365 CRM: create or update Contacts and Leads (matched by email), create Accounts
- Dynamics 365 Sales: create Opportunities, Quotes, Sales Orders, and Invoices
- Dynamics 365 Marketing: create or update Marketing Contacts (matched by email)
- Dynamics 365 Customer Service: create Cases, add Notes to existing Cases
- Dynamics 365 Field Service: create Work Orders and Service Requests
- Dataverse (Generic): create a record in any built-in or custom table
What You’ll Need
- A Dynamics 365 / Power Platform environment and admin access to Azure (Microsoft Entra ID)
- Permission to create an App registration and an Application User
- The AFI plugin installed and active
- A form plugin connected as the sender
Connect Dynamics 365 to AFI (one-time setup)
All six platforms share a single connection, configured under AFI > Settings > Dynamics 365 CRM. The connection uses an Azure app registration with the client credentials flow, so no user login is involved.
- Go to portal.azure.com, open Microsoft Entra ID > App registrations > New registration. Name it (for example “AFI Dynamics”), leave the Redirect URI blank, and register.

- On the app’s Overview page, copy the Application (client) ID and the Directory (tenant) ID.
- Go to Certificates & secrets > New client secret. Copy the secret’s Value column (not the Secret ID). It is shown only once.
- Go to API permissions > Add a permission > Dynamics CRM > Application permissions, add user_impersonation, then click Grant admin consent.
- Create an Application User inside Dynamics: go to admin.powerplatform.microsoft.com > Environments > your environment > Settings > Users + permissions > Application users > New app user. Pick your Azure app, a Business Unit, and assign a Security Role with write access to the entities you need (System Administrator works for testing).

- Copy your environment base URL, for example https://yourorg.crm.dynamics.com.
- In WordPress, go to AFI > Settings, enable the Dynamics 365 CRM tab, and enter the Instance URL, Tenant (Directory) ID, Application (Client) ID, and Client Secret Value. Click Save & Verify.

Why both Azure permissions and an Application User? Azure decides whether AFI may request a Dynamics token; Dynamics decides whether that token can access records. Both are required.
How to Create an Integration
- Go to AFI > Add New and rename the auto-filled Integration Title.
- Under Trigger, select your form plugin and the specific form.
- Under Action > Platform, select the Dynamics app you need (see the sections below) and its task.
- Map the fields, then click Save Integration.
Dynamics 365 CRM
Tasks: Create / Update Contact (by email), Create / Update Lead (by email), Create Account.
Contacts and Leads are deduplicated by email: if a record with the same email exists, it is updated instead of duplicated. Key contact fields:
| Field | Description |
|---|---|
| First Name, Last Name | Contact name |
| Primary Email, Secondary Email | Primary email is the dedupe key |
| Business Phone, Mobile Phone | Phone numbers |
| Address Line 1/2, City, State / Province, Postal Code, Country | Address block |
| Job Title, Department, Company Name | Role details |
| Account Name (link to Account) | If a matching Account exists, the contact is linked to it |
| Website, Description / Notes | Extra details |
| Lead Source, Preferred Contact Method, Gender | Option set values (numeric) |
| Birth Date | YYYY-MM-DD format |
| Do Not Email, Do Not Bulk Email, Do Not Phone | true/false consent flags |
| Owner ID | System user GUID |
Lead fields are similar and add Topic / Subject, Industry, Estimated Revenue, and Number of Employees.
Dynamics 365 Sales
Tasks: Create Opportunity, Create Quote, Create Sales Order, Create Invoice.
Each task needs a customer. Map Account Name to link an existing Account (preferred), or Contact Email as a fallback: if no matching Contact exists, one is created using the mapped Contact First Name and Last Name. Then map the record’s own fields, such as Opportunity Name (Topic) and Description.
Dynamics 365 Marketing
Task: Create / Update Marketing Contact (by email). Email is required and used to dedupe. Fields include First Name, Last Name, Business Phone, Mobile Phone, Company Name, Job Title, City, Country, Lead Source (numeric option set value, for example 1 = Advertisement), and the Do Not Email / Do Not Bulk Email / Do Not Phone consent flags.
Dynamics 365 Customer Service
Tasks: Create Case (incident) and Add Note to existing Case.
For new Cases, map the required Case Title, plus Contact Email (links or creates the Contact), Contact First and Last Name, and Account Name as a fallback customer. For notes, map the Case GUID (incidentid), Note Subject (both required), and the Note Text.
Dynamics 365 Field Service
Tasks: Create Work Order and Create Service Request (Work Order).
Service Account Name is required and must match an existing Account. Optional fields include Primary Contact Email, Subject / Title (required), Description, Incident Type Name, Work Order Type Name, Priority Name (all resolved by lookup), and Promised Window From/To as ISO datetimes.
Dataverse (Generic)
Task: Create Record in any table. This is the power-user option: pick any entity set in your environment (built-in like contacts or leads, or custom tables like publisher_mytable) from a dropdown populated from your environment’s metadata, then map fields by their logical names. It reuses the Dynamics 365 CRM connection, so no extra setup is needed.
Troubleshooting
Save & Verify fails
Check all four values: Instance URL (https://yourorg.crm.dynamics.com, no trailing path), Tenant ID, Client ID, and the secret’s Value (not its ID). Secrets expire, so create a new one if the connection worked before and stopped.
Token is issued but records are not created
That usually means the Application User step was skipped or its Security Role lacks write access to the target entity. Revisit step 5 of the setup.
Option set fields are rejected
Fields like Lead Source, Industry, and Gender expect the numeric option set value, not the label. Look up the values in your Dynamics customization settings.
Records are not appearing
Go to AFI > Log and open the latest entry. The Dataverse error message in the response usually names the exact field causing the problem.