Embedding Dynamics 365 Sales Forms allows you to integrate rich CRM functionality directly into custom apps, websites, or internal portals. This enhances the user experience by eliminating context-switching, enabling users to interact with CRM data where they work most. This guide will walk you through the step-by-step process of embedding Dynamics 365 Sales forms (such as lead, contact, or opportunity forms) using tools like Power Apps, Power Pages, and iFrames, along with best practices, security considerations, and real-world use cases.
What Does It Mean to Embed a Sales Form?
Embedding a Dynamics 365 Sales form means presenting the UI of a standard or custom entity form (e.g., a Lead or Opportunity form) in another application, web page, or platform. The goal is to:
- Allow users to view or edit records without logging into Dynamics directly.
- Embed interactive forms in external portals or partner apps.
- Enable read-only or editable experiences depending on the context.
Prerequisites
Before proceeding, ensure you have:
- A Dynamics 365 Sales license and instance.
- Appropriate security roles (e.g., System Customizer, Sales Manager).
- Admin access to Power Platform Admin Center.
- (Optional) Power Pages setup, if embedding in a customer portal.
- Basic knowledge of HTML and JavaScript, if embedding via iframe or custom app.
Step-by-Step Guide
1. Create or Configure Your Sales Form
You can embed either default forms or custom forms for entities like:
- Lead
- Opportunity
- Contact
- Account
Steps:
- Navigate to Power Apps > Solutions > Your Solution.
- Select the table (entity), e.g., Lead.
- Go to Forms > Main Form.
- Customize the form as required (add fields, sections, etc.).
- Publish your changes.
2. Enable Form for External Access (for Power Pages or iframe)
If you are embedding in Power Pages or using an iframe, the form needs to be exposed as part of a Dataverse table permissions and web page setup:
For Power Pages:
- Go to Power Pages > Design Studio.
- Select Pages > Add a Page.
- Add a Form Component:
- Data Source: Choose the Dataverse table (e.g., Contact).
- Mode: Insert/Edit/Read-only.
- Web Form: Link it to the form you created earlier.
- Configure Table Permissions so that external users can access relevant records.
- Publish the site.
3. Embed in a Web App or External Website (Using iFrame)
If embedding using HTML:
<iframe
width="100%"
height="800"
src="https://yourorg.crm.dynamics.com/main.aspx?appid=YOUR_APP_ID&pagetype=entityrecord&etn=lead&id=RECORD_GUID"
frameborder="0">
</iframe>
Parameters:
- appid: Application ID of your custom Dynamics 365 Sales App.
- pagetype: Should be
entityrecord
. - etn: Entity name (e.g.,
lead
,opportunity
). - id: GUID of the record you want to open. Leave this empty to open a new record.
Notes:
- User must be authenticated to Dynamics 365.
- For external/public scenarios, use Power Pages, not iframe.
4. Embed into Power Apps (Canvas App)
You can create a Power App that surfaces Dynamics 365 Sales forms:
- Open Power Apps > Create > Canvas App.
- Connect to Dataverse.
- Add EditForm or DisplayForm component.
- Set:
- Data Source: e.g., Leads.
- Item:
LookUp(Leads, LeadId = selectedLeadId)
- Customize form layout.
- Save and publish.
5. Use Power Automate to Pre-Populate Forms
Trigger Dynamics form creation via Power Automate and prefill values:
- Trigger: “When an item is created in SharePoint”
- Action: “Create a new Lead in Dynamics 365”
- Action: “Send Email with link to Lead form (with record ID)”
Security Considerations
- Ensure users have minimum permissions needed (Read, Write, Append).
- Use Conditional Access Policies for embedded apps.
- Enable Multi-Factor Authentication (MFA) if accessed externally.
- Do not hard-code credentials in iframes or apps.
Real Use Cases
Scenario | Description |
---|---|
Customer Portal | Partners can view/edit leads and opportunities via Power Pages. |
Sales Dashboard | Sales managers embed lead forms in their Power BI or Power Apps dashboard. |
Email with Deep Links | Automated emails with prefilled form links for faster data capture. |
Mobile Sales App | Embed contact and account forms in a mobile canvas app for sales reps. |
Best Practices
- Use Custom Pages in Model-driven apps for more flexible layout.
- Embed context-aware forms with pre-filtered views using parameters.
- Use Role-based Access Control (RBAC) to tailor form visibility.
- Keep form designs simple for better performance in embedded contexts.
Testing and Debugging
- Test in incognito mode to avoid caching issues.
- Use Developer Tools (F12) to inspect iframe loading issues.
- Log user actions and errors using Application Insights for deeper monitoring.