Subgrids and Quick View Forms

Loading

Table of Contents

  1. Introduction to Subgrids
  2. Subgrid Configuration
  3. Subgrid Customization Options
  4. Introduction to Quick View Forms
  5. Quick View Form Configuration
  6. Best Practices for Subgrids and Quick View Forms
  7. Advanced Techniques
  8. Common Use Cases
  9. Troubleshooting
  10. 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

  1. Open the form editor in the Power Apps maker portal
  2. Select the form where you want to add the subgrid
  3. Navigate to the tab or section where the subgrid should appear
  4. Click “Add Component” and select “Subgrid”
  5. 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

PropertyDescription
Default ViewThe view that will be displayed in the subgrid
Allow users to change viewWhether users can switch between available views
Display view selectorShows/hides the view selector dropdown
Records per pageNumber of records displayed per page
Enable in-line editingAllows editing records directly in the subgrid
Show add existing buttonDisplays button to add existing related records
Show add new buttonDisplays button to create new related records
Show delete buttonDisplays button to delete records from the subgrid

3. Subgrid Customization Options

Customizing Subgrid Appearance

  1. Column Configuration:
  • Choose which columns to display
  • Set column widths
  • Configure column ordering
  1. Sorting and Filtering:
  • Set default sort order
  • Apply default filters
  • Enable user sorting and filtering
  1. 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

  1. Navigate to the entity in the Power Apps maker portal
  2. Select “Forms” under the “Data” section
  3. Click “New” and choose “Quick View Form”
  4. Configure the form properties:
  • Name: Internal name for the form
  • Display Name: Label shown to users
  • Entity: The entity this quick view will represent
  1. 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

  1. Open the main form where the Quick View should appear
  2. Add a lookup field or identify an existing lookup
  3. 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

PropertyDescription
NameInternal identifier for the form
Display NameLabel shown in the form selector
EntityThe entity this quick view represents
LayoutCard or other visual layout options
Field SelectionWhich fields to include in the quick view
Section OrganizationHow fields are grouped and arranged

6. Best Practices for Subgrids and Quick View Forms

Subgrid Best Practices

  1. Limit the Number of Subgrids:
  • Avoid cluttering forms with too many subgrids
  • Consider using multiple tabs to organize subgrids
  1. Optimize Performance:
  • Limit the number of records displayed
  • Use appropriate views with necessary columns only
  • Consider lazy loading for large datasets
  1. User Experience Considerations:
  • Place most important subgrids prominently
  • Use meaningful labels and tooltips
  • Ensure consistent behavior across forms

Quick View Form Best Practices

  1. Focus on Key Information:
  • Include only the most critical fields
  • Avoid duplicating information available elsewhere
  1. Consistent Design:
  • Maintain consistent layout with other quick views
  • Use standard formatting and spacing
  1. 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

  1. Account Contacts:
  • Display all contacts related to an account
  • Allow quick addition of new contacts
  1. Case Activities:
  • Show all activities related to a case
  • Enable quick creation of follow-up tasks
  1. Opportunity Products:
  • List all products in an opportunity
  • Support in-line editing of quantities and prices

Quick View Form Use Cases

  1. Contact Manager Information:
  • Show key details about a contact’s manager
  • Display phone and email for quick communication
  1. Account Summary:
  • Present essential account details when viewing related records
  • Show revenue, industry, and key contacts
  1. Product Details:
  • Display product specifications when viewing opportunity line items
  • Show inventory levels and pricing information

9. Troubleshooting

Common Subgrid Issues

  1. Subgrid Not Displaying Records:
  • Verify the relationship is correct
  • Check the view configuration
  • Ensure proper security roles
  1. Performance Problems:
  • Optimize the view with fewer columns
  • Implement server-side filtering
  • Consider asynchronous loading
  1. Buttons Not Appearing:
  • Check subgrid properties for button visibility
  • Verify security privileges
  • Review form scripting that might disable buttons

Common Quick View Form Issues

  1. Quick View Not Appearing:
  • Verify the lookup field is properly configured
  • Check that the quick view form is published
  • Ensure the relationship exists
  1. Missing Fields:
  • Confirm fields are added to the quick view form
  • Check field-level security
  • Verify the fields are published
  1. Performance Delays:
  • Reduce the number of fields in the quick view
  • Avoid complex calculated fields
  • Consider asynchronous loading

Leave a Reply

Your email address will not be published. Required fields are marked *