![]()
Table of Contents
- Introduction to Subgrids
- Subgrid Configuration
- Subgrid Customization Options
- Introduction to Quick View Forms
- Quick View Form Configuration
- Best Practices for Subgrids and Quick View Forms
- Advanced Techniques
- Common Use Cases
- Troubleshooting
- Conclusion
1. Introduction to Subgrids
Subgrids are powerful components in Dynamics 365 that allow you to display related entity records directly on a form. They provide a convenient way to view and interact with associated data without navigating away from the current record.
Key Features of Subgrids:
- Display related records in a tabular format
- Allow in-line editing of records (when configured)
- Provide quick access to associated data
- Support sorting, filtering, and searching
- Enable users to add new related records directly from the subgrid
Benefits of Using Subgrids:
- Improved user experience by reducing navigation
- Better context for related data
- Increased productivity through direct access to associated records
- Customizable display options to match business requirements
2. Subgrid Configuration
Adding a Subgrid to a Form
- Open the form editor in the Power Apps maker portal
- Select the form where you want to add the subgrid
- Navigate to the tab or section where the subgrid should appear
- Click “Add Component” and select “Subgrid”
- Configure the subgrid properties:
- Name: Internal name for the subgrid
- Label: Display label shown to users
- Entity: The related entity to display
- Relationship: The relationship between the current entity and the related entity
- View: Which view to use for displaying records
Subgrid Properties
| Property | Description |
|---|---|
| Default View | The view that will be displayed in the subgrid |
| Allow users to change view | Whether users can switch between available views |
| Display view selector | Shows/hides the view selector dropdown |
| Records per page | Number of records displayed per page |
| Enable in-line editing | Allows editing records directly in the subgrid |
| Show add existing button | Displays button to add existing related records |
| Show add new button | Displays button to create new related records |
| Show delete button | Displays button to delete records from the subgrid |
3. Subgrid Customization Options
Customizing Subgrid Appearance
- Column Configuration:
- Choose which columns to display
- Set column widths
- Configure column ordering
- Sorting and Filtering:
- Set default sort order
- Apply default filters
- Enable user sorting and filtering
- Behavior Customization:
- Control read-only vs. editable subgrids
- Configure button visibility (add, delete, etc.)
- Set row selection options
Using JavaScript with Subgrids
Subgrids can be enhanced with JavaScript to provide additional functionality:
function onSubgridLoad(executionContext) {
var formContext = executionContext.getFormContext();
var subgrid = formContext.getControl("subgrid_name");
// Example: Set a custom view
subgrid.getViewSelector().setDefaultView("{00000000-0000-0000-0000-000000000001}");
// Example: Disable add button conditionally
var recordStatus = formContext.getAttribute("statuscode").getValue();
if (recordStatus === "Inactive") {
subgrid.setDisabledButtons(["Add"]);
}
}
4. Introduction to Quick View Forms
Quick View Forms provide a way to display key information from a related record without navigating away from the current form. They appear as compact, read-only forms that show selected fields from the related entity.
Key Features of Quick View Forms:
- Display related record information in a condensed format
- Read-only presentation of data
- Appear as pop-ups or embedded sections
- Can be triggered from lookups or other controls
- Highly customizable field selection
Benefits of Quick View Forms:
- Reduced need for navigation between records
- Quick access to important related information
- Clean, focused presentation of key data
- Improved form efficiency and user productivity
5. Quick View Form Configuration
Creating a Quick View Form
- Navigate to the entity in the Power Apps maker portal
- Select “Forms” under the “Data” section
- Click “New” and choose “Quick View Form”
- Configure the form properties:
- Name: Internal name for the form
- Display Name: Label shown to users
- Entity: The entity this quick view will represent
- Add fields to the form:
- Drag and drop fields from the field explorer
- Organize into sections as needed
- Configure field properties (labels, visibility)
Adding Quick View Controls to a Form
- Open the main form where the Quick View should appear
- Add a lookup field or identify an existing lookup
- Configure the lookup properties:
- Enable “Show Quick View Form”
- Select the Quick View Form to use
- Set the layout and display options
Quick View Form Properties
| Property | Description |
|---|---|
| Name | Internal identifier for the form |
| Display Name | Label shown in the form selector |
| Entity | The entity this quick view represents |
| Layout | Card or other visual layout options |
| Field Selection | Which fields to include in the quick view |
| Section Organization | How fields are grouped and arranged |
6. Best Practices for Subgrids and Quick View Forms
Subgrid Best Practices
- Limit the Number of Subgrids:
- Avoid cluttering forms with too many subgrids
- Consider using multiple tabs to organize subgrids
- Optimize Performance:
- Limit the number of records displayed
- Use appropriate views with necessary columns only
- Consider lazy loading for large datasets
- User Experience Considerations:
- Place most important subgrids prominently
- Use meaningful labels and tooltips
- Ensure consistent behavior across forms
Quick View Form Best Practices
- Focus on Key Information:
- Include only the most critical fields
- Avoid duplicating information available elsewhere
- Consistent Design:
- Maintain consistent layout with other quick views
- Use standard formatting and spacing
- Performance Optimization:
- Limit the number of fields displayed
- Avoid complex business rules in quick views
7. Advanced Techniques
Conditional Display of Subgrids
You can show or hide subgrids based on form conditions using JavaScript:
function toggleSubgridVisibility(executionContext) {
var formContext = executionContext.getFormContext();
var subgrid = formContext.getControl("subgrid_name");
var showCondition = formContext.getAttribute("field_name").getValue();
if (showCondition === "Show") {
subgrid.setVisible(true);
} else {
subgrid.setVisible(false);
}
}
Customizing Quick View Forms with JavaScript
Enhance quick view forms with custom behaviors:
function customizeQuickView(executionContext) {
var formContext = executionContext.getFormContext();
var quickViewControl = formContext.getControl("quickview_name");
// Example: Change quick view based on another field
var accountType = formContext.getAttribute("accounttype").getValue();
if (accountType === "Preferred") {
quickViewControl.setQuickViewFormId("{NEW-FORM-GUID}");
}
}
Integrating Subgrids with Business Rules
Business rules can be used to:
- Show/hide subgrids based on field values
- Enable/disable subgrid buttons conditionally
- Change subgrid views dynamically
8. Common Use Cases
Subgrid Use Cases
- Account Contacts:
- Display all contacts related to an account
- Allow quick addition of new contacts
- Case Activities:
- Show all activities related to a case
- Enable quick creation of follow-up tasks
- Opportunity Products:
- List all products in an opportunity
- Support in-line editing of quantities and prices
Quick View Form Use Cases
- Contact Manager Information:
- Show key details about a contact’s manager
- Display phone and email for quick communication
- Account Summary:
- Present essential account details when viewing related records
- Show revenue, industry, and key contacts
- Product Details:
- Display product specifications when viewing opportunity line items
- Show inventory levels and pricing information
9. Troubleshooting
Common Subgrid Issues
- Subgrid Not Displaying Records:
- Verify the relationship is correct
- Check the view configuration
- Ensure proper security roles
- Performance Problems:
- Optimize the view with fewer columns
- Implement server-side filtering
- Consider asynchronous loading
- Buttons Not Appearing:
- Check subgrid properties for button visibility
- Verify security privileges
- Review form scripting that might disable buttons
Common Quick View Form Issues
- Quick View Not Appearing:
- Verify the lookup field is properly configured
- Check that the quick view form is published
- Ensure the relationship exists
- Missing Fields:
- Confirm fields are added to the quick view form
- Check field-level security
- Verify the fields are published
- Performance Delays:
- Reduce the number of fields in the quick view
- Avoid complex calculated fields
- Consider asynchronous loading
