logo
FormsSharePointPower Apps
Dec 02

How to create related SharePoint list items with Power Apps

Customer Support Engineer

To display related SharePoint list items in Power Apps, connect two lists through a Lookup column and use the Data Grid or Gallery control. Adding, editing, and deleting related items requires additional controls and Power Fx formulas.

But getting this to work isn't always straightforward.

I now want to add a "related projects" option where users can pull up a project and identify any other projects in the same list as related. I tried adding a lookup column that pulls in all the projects in the list, but couldn't get that to play nicely in Power Apps.
JennC26, Power Platform Community

In this tutorial, I'll show you how to build a purchase request form with related products in Power Apps and compare this approach with Plumsail Forms' built-in List or Library control for internal and external forms.

Purchase request form build in Power Apps  

In this article:

 

Create two related SharePoint lists

Employees use the form to enter request details and add as many products as necessary, all from one form.

Create two SharePoint lists to store this data.

  • Purchase Requests is our parent list. It contains general information about each request:

    • Requested by

    • Manager

    • Department

  • Purchase Items is the child list. It stores the products associated with each request:

    • Title (the product name)

    • Quantity

    • Unit Price

    • Purchase Request (a lookup column linking a product to its parent request)

The Purchase Request lookup column points to the Purchase Requests list. It links each product to its parent request by ID.

Lookup column for connecting two lists  

This establishes a one-to-many relationship: one purchase request can contain multiple purchase items, while each purchase item belongs to one request.

How to create related items in Power Apps

Power Apps gives you two main ways to work with SharePoint list data: customize the existing SharePoint form or create a standalone canvas app.

With Customize forms, Power Apps replaces the default SharePoint New, Edit, and Display forms. Users continue working directly in the SharePoint list, but with a customized interface. The form already knows which list item is being created or edited.

With Create an app, Power Apps generates a separate canvas application connected to your SharePoint list. You get more flexibility to design multiple screens, navigation, and additional functionality. However, you also need to manage how users navigate between records and how the application is shared.

For this tutorial, I will customize the SharePoint form. Employees will add and edit purchase items directly from the Purchase Requests list, without accessing a separate application.

Step 1. Customize the SharePoint form

  1. Open the Purchase Requests list in SharePoint.

  2. Select Integrate → Power Apps → Customize forms.

    Power Apps - Customize forms  

  3. An auto-generated form connected to the Purchase Requests list opens.

  4. Open the Data panel, expand Connectors, select SharePoint and add the Purchase Items list as another data source.

    Power Apps - add data from SharePoint list  

The form can now access both lists.

Step 2. Add Data Grid control to display related items on the form

Now we need a way to display items related to the purchase request, with the ability to add new ones, edit or delete existing items.

The most common approach is to use a Gallery. However, we will try out the new modern Data Grid control. The control was recently released and replaces the deprecated Table control. With Data Grid control, users can select rows, sort data, and search records. Adding and editing products requires separate input controls and Power Fx formulas, which the following steps explain.

Add a modern Data Grid below the purchase request details and name it dgPurchaseItems.

In the control settings, open the Display tab and set SelectMultiple to false so users can select one product at a time:

Data Grid - Control properties  

The control will be connected to a collection called colPurchaseRows, which will temporarily store products while users work with the form. But first, we need to initialize the collection so Power Apps can recognize its columns.

Select the Data Grid. On the Advanced tab, set its Items property to:

Filter(colPurchaseRows, !Deleted)

 

Initialize the collection with sample data

Add a temporary button to the form and set its OnSelect property to:

ClearCollect(
    colPurchaseRows,
    {
        RowKey: "sample-1",
        ChildID: 0,
        Product: "Laptop",
        Quantity: 5,
        UnitPrice: 850,
        Changed: false,
        Deleted: false
    }
)

 

Hold Alt and click the button to execute the formula. This creates a collection containing a sample product and the fields we'll use later.

Add columns to the Data Grid

With the sample data loaded, select the Data Grid, then go to Display → Fields to configure the columns:

Data Grid - Configure fields  

Add three columns: Product, Quantity, and UnitPrice.

The modern Data Grid supports different column types, including Text, Number, Email, and URL.

For our example, configure the columns as follows:

  • Product: Set Type to Text and Value to ThisItem.Product.
  • Quantity: Set Type to Number and Value to ThisItem.Quantity.
  • Unit price: Set Type to Number and Value to ThisItem.UnitPrice.

You can also change the column headers and widths to make the table easier to read.

The Data Grid is now ready.

Step 3. Add the product editor

Below the Data Grid, add a container named conProductEditor. It will hold the controls for adding and editing products and be visible only when needed.

Set the editor container's Advanced → Visible property to:

!IsBlank(varEditorMode) &&
SharePointForm1.Mode <> FormMode.View

 

The editor appears only when a user chooses to add or edit a product.

Add three classic Text input controls for Product, Quantity, and Unit Price. For the Quantity and Unit Price fields, set the Format property to Number. These inputs will let users enter product details.

Set each input control's Advanced → Default property to the corresponding formula below:

//txtEditProduct
If(
    varEditorMode = "Edit",
    LookUp(colPurchaseRows, RowKey = varEditKey, Product),
    ""
)

// txtEditQty
If(
    varEditorMode = "Edit",
    Text(LookUp(colPurchaseRows, RowKey = varEditKey, Quantity)),
    "1"
)

//txtEditPrice
If(
    varEditorMode = "Edit",
    Text(LookUp(colPurchaseRows, RowKey = varEditKey, UnitPrice)),
    "0"
)

 

Add Save product and Cancel editing buttons inside the container.

The form now includes a Data Grid and a product editor:

Data Grid with product editor  

Button formulas for saving and canceling product edits

For the Save product button, set its OnSelect property to:

If(
    IsBlank(Trim(txtEditProduct.Text)) ||
    !IsNumeric(txtEditQty.Text) ||
    Value(txtEditQty.Text) <= 0 ||
    !IsNumeric(txtEditPrice.Text) ||
    Value(txtEditPrice.Text) < 0,

    Notify(
        "Enter a product name, valid quantity, and price.",
        NotificationType.Error
    ),

    If(
        varEditorMode = "Add",

        Collect(
            colPurchaseRows,
            {
                RowKey: Text(GUID()),
                ChildID: 0,
                Product: Trim(txtEditProduct.Text),
                Quantity: Value(txtEditQty.Text),
                UnitPrice: Value(txtEditPrice.Text),
                Changed: true,
                Deleted: false
            }
        ),

        Patch(
            colPurchaseRows,
            LookUp(
                colPurchaseRows,
                RowKey = varEditKey
            ),
            {
                Product: Trim(txtEditProduct.Text),
                Quantity: Value(txtEditQty.Text),
                UnitPrice: Value(txtEditPrice.Text),
                Changed: true
            }
        )
    );

    Set(varEditorMode, Blank());
    Set(varEditKey, Blank());
    Reset(dgPurchaseItems)
)

 

The formula validates the input, then uses Collect() to add a product or Patch() to update an existing row in the collection.

For the product editor's Cancel button, use this formula in its OnSelect property:

Set(varEditorMode, Blank());
Set(varEditKey, Blank())

 

Step 4. Add buttons for adding, editing, and deleting products

Add buttons for Add, Edit, and Delete above the Data Grid.

For the Add button, set its OnSelect property to:

Set(varEditorMode, "Add");
Set(varEditKey, Blank());

Reset(txtEditProduct);
Reset(txtEditQty);
Reset(txtEditPrice)

 

For the Edit button, set its OnSelect property to:

If(
    IsBlank(dgPurchaseItems.Selected.RowKey),

    Notify(
        "Select a product first.",
        NotificationType.Warning
    ),

    Set(varEditKey, dgPurchaseItems.Selected.RowKey);
    Set(varEditorMode, "Edit");

    Reset(txtEditProduct);
    Reset(txtEditQty);
    Reset(txtEditPrice)
)

 

To edit a product, select its row in the Data Grid, click Edit, update the details, and click Save product.

For the Delete product button, use this formula in its OnSelect property:

If(
    IsBlank(dgPurchaseItems.Selected.RowKey),

    Notify(
        "Select a product first.",
        NotificationType.Warning
    ),

    With(
        {
            row: dgPurchaseItems.Selected
        },

        If(
            row.ChildID = 0,

            RemoveIf(
                colPurchaseRows,
                RowKey = row.RowKey
            ),

            Patch(
                colPurchaseRows,
                LookUp(
                    colPurchaseRows,
                    RowKey = row.RowKey
                ),
                {
                    Deleted: true,
                    Changed: true
                }
            )
        )
    );

    Set(varEditorMode, Blank());
    Set(varEditKey, Blank());
    Reset(dgPurchaseItems)
)

 

Deleting a newly added product removes it from the collection. Deleting a product already saved in SharePoint marks it for deletion when the parent form is saved.

The Data Grid hides rows marked with Deleted = true, so the product disappears from the table immediately.

Step 5. Save the parent request and related items

A new purchase request receives its SharePoint ID only after it is saved. Related products must therefore remain in a temporary collection until the parent request is saved.

Users can add, edit, and delete products in this collection before submitting the form.

Set up for the New form

Select the SharePointIntegration control and set its OnNew property to:

ClearCollect(
    colPurchaseRows,
    {
        RowKey: "",
        ChildID: 0,
        Product: "",
        Quantity: 0,
        UnitPrice: 0,
        Changed: false,
        Deleted: false
    }
);
Clear(colPurchaseRows);

Set(varEditorMode, Blank());
Set(varEditKey, Blank());

NewForm(SharePointForm1)

 

This initializes an empty collection with the fields our Data Grid expects and opens the parent form in New mode.

Configure the Edit and Display forms

Employees also need to view existing purchase requests and edit their related products.

Reuse the same Data Grid and product editor. Load the products linked to the selected request from SharePoint into colPurchaseRows.

Edit form

Select the SharePointIntegration control and set its OnEdit property to:

EditForm(SharePointForm1);

Refresh('Purchase Items');

ClearCollect(
    colPurchaseRows,
    {
        RowKey: "",
        ChildID: 0,
        Product: "",
        Quantity: 0,
        UnitPrice: 0,
        Changed: false,
        Deleted: false
    }
);
Clear(colPurchaseRows);

Collect(
    colPurchaseRows,
    ForAll(
        Filter(
            'Purchase Items',
            'Purchase Request'.Id =
                SharePointIntegration.SelectedListItemID
        ) As item,

        {
            RowKey: Text(GUID()),
            ChildID: item.ID,
            Product: item.Title,
            Quantity: item.Quantity,
            UnitPrice: item.'Unit Price',
            Changed: false,
            Deleted: false
        }
    )
);

Set(varEditorMode, Blank());
Set(varEditKey, Blank())

 

This formula loads the products linked to the selected purchase request into colPurchaseRows.

The Data Grid displays these products because its Items property uses this collection.

Users can add products, edit existing ones, or mark them for deletion. These changes remain in the collection until the parent form is saved.

The OnSuccess formula in the next section creates, updates, and deletes related items in both New and Edit modes.

Display form

Copy the OnEdit formula to the OnView property of SharePointIntegration. In the opening statement, replace EditForm with ViewForm:

ViewForm(SharePointForm1)

 

This opens the parent form in View mode and loads its related products into the Data Grid.

To hide the Add, Edit, and Delete buttons in View mode, use the following condition in each button's Visible property. For Edit and Delete, combine it with the existing row-selection condition if you configured one:

SharePointForm1.Mode <> FormMode.View

 

Set the OnCancel property of SharePointIntegration to:

ResetForm(SharePointForm1);
Clear(colPurchaseRows);
Set(varEditorMode, Blank());
Set(varEditKey, Blank())

 

This resets the parent form, clears the product collection, and resets the editor variables when the user cancels the form.

Configure saving the parent request and related products

When users click Save in the SharePoint form, save the parent request first. Then apply the changes to its related products, using the saved request's ID to link new items.

Set the OnSave property of SharePointIntegration to the formula below. It prompts users to save or cancel the product they are editing before submitting the parent form:

If(
    !IsBlank(varEditorMode),

    Notify(
        "Save or cancel the product you're editing first.",
        NotificationType.Warning
    ),

    SubmitForm(SharePointForm1)
)

 

Next, select SharePointForm1 and set its OnSuccess property to the formula below. It applies the related product changes after the parent request is saved and collects any errors in colSaveErrors:

Clear(colSaveErrors);

With(
    {
        parent: SharePointForm1.LastSubmit
    },

    ForAll(
        Filter(
            colPurchaseRows,
            Deleted && ChildID > 0
        ) As row,

        IfError(
            Remove(
                'Purchase Items',
                LookUp(
                    'Purchase Items',
                    ID = row.ChildID
                )
            ),
            Collect(
                colSaveErrors,
                {
                    RowKey: row.RowKey,
                    Message: FirstError.Message
                }
            );
            Blank()
        )
    );

    ForAll(
        Filter(
            colPurchaseRows,
            !Deleted &&
            (Changed || ChildID = 0)
        ) As row,

        IfError(
            Patch(
                'Purchase Items',

                If(
                    row.ChildID = 0,
                    Defaults('Purchase Items'),
                    LookUp(
                        'Purchase Items',
                        ID = row.ChildID
                    )
                ),

                {
                    Title: row.Product,
                    Quantity: row.Quantity,
                    'Unit Price': row.UnitPrice,
                    'Purchase Request': {
                        Id: parent.ID,
                        Value: parent.Title
                    }
                }
            ),

            Collect(
                colSaveErrors,
                {
                    RowKey: row.RowKey,
                    Message: FirstError.Message
                }
            );
            Blank()
        )
    )
);

If(
    IsEmpty(colSaveErrors),

    Clear(colPurchaseRows);
    ResetForm(SharePointForm1);
    RequestHide(),

    Notify(
        "The request was saved, but some product changes failed. Check the Purchase Items list before retrying.",
        NotificationType.Error
    )
)

 

The save process works as follows:

  1. SubmitForm() saves the parent purchase request.
  2. The OnSuccess formula reads the saved record from SharePointForm1.LastSubmit and uses its ID to link new products to the request.
  3. The first ForAll() deletes existing SharePoint items marked for deletion.
  4. The second ForAll() uses Patch() to create new items and update modified ones, setting their Purchase Request lookup values.
  5. IfError() collects any errors from product changes in colSaveErrors.
  6. If no errors are reported, the formula clears the collection, resets the form, and closes it. Otherwise, it displays an error message and leaves the form open.

For example, saving a new request with three products creates one item in Purchase Requests and three related items in Purchase Items.

Finalize and publish the form

Save your changes and select Publish to SharePoint.

Power Apps - Final form with related products  

Now the same customized SharePoint form can create new purchase requests with multiple products, display existing related records, and add, edit, or delete products.

The important difference from saving records individually is that all changes are staged until users submit the parent form.

Alternatives: Other ways to work with related records in Power Apps

The Data Grid is only one option. Depending on the interface you want, there are several other approaches worth considering.

Classic Gallery with editable controls

The classic Gallery control is more flexible than Data Grid when you need direct editing.

You can place Text input controls inside each gallery row, allowing employees to change product names, quantities, and prices in a line-by-line manner.

You can also add buttons for inserting and removing rows, making the gallery behave like a spreadsheet.

The downside is that you need to arrange the controls manually, configure how each input updates your collection, and handle saving changes to SharePoint.

Microsoft has an official tutorial showing how to create this type of interface: Create an app to edit tables in canvas apps.

For users who want to edit several products quickly, an editable Gallery may be more convenient than Data Grid with a separate editor.

Modern Card Gallery

The newer Card Gallery control displays records as responsive cards rather than table rows. It's also currently in preview.

It supports record selection, grouping, and multiple selections.

For our purchase request scenario, each card could show a product's name, quantity, and unit price. Users could select a card and edit its information through a separate Form or custom editor, much like the Data Grid approach.

For a practical example, see Reza Dorrani's video: Power Apps Just Got 4 NEW Modern Controls — Card Gallery, Metrics Card & More.

Pros and cons of creating related items with Power Apps

Power Apps can handle related SharePoint records, and it offers several ways to build the interface. You can use Data Grid for a modern table, an editable Gallery for inline changes, or separate forms for individual records.

However, the functionality for managing related SharePoint items still requires additional configuration.

Advantages

  • Native Microsoft 365 integration: Customize SharePoint list forms without introducing another form platform.
  • Flexible interface: Choose between Data Grid, editable galleries, Card Gallery, separate forms, and other controls.
  • Custom business logic: Power Fx lets you control how related records are created, updated, validated, and deleted.
  • Multiple data sources: Combine SharePoint lists with other supported connectors.
  • Licensing: SharePoint is a standard connector. For many Microsoft 365 users, customized SharePoint forms using only standard connectors are covered by existing Power Apps use rights without an additional Premium license.

Limitations

  • No built-in related-items control for SharePoint-integrated canvas forms: You need to build the interface and configure how records are linked.
  • Power Fx configuration: Creating, updating, deleting, and tracking changes across multiple records requires knowledge of Power Fx and development effort
  • Error handling and maintenance: You need to account for failed saves, duplicate records, concurrent changes, and changes made by other users. All of this requires additional configuration and testing.
  • Performance considerations: SharePoint delegation limitations may affect how many related records can be loaded and processed.
  • External users: Customized SharePoint forms are designed for users who have access to the SharePoint environment and the underlying lists.

For simple parent-child relationships, Power Apps is a workable option. And the newer controls make it easier to create modern-looking interfaces.

However, adding, editing, deleting, and saving multiple records together requires more configuration.

If your main goal is simply to manage related SharePoint items from a single form, there's a simpler approach.

Have you tried creating related SharePoint items with Power Apps? Which approach did you use, and what challenges did you run into?
Share your experience in our Reddit discussion and see how others have approached similar scenarios.

Create related items with Plumsail Forms' List or Library control

Plumsail Forms for SharePoint has a List or Library control specifically designed for working with related SharePoint lists and document libraries. It allows users to view, add, edit, and delete records from another list directly inside the parent form.

The control supports:

  • Parent-child relationships: Automatically link items through a SharePoint Lookup column.
  • Inline and dialog editing: Edit records directly in a table or open a separate form.
  • SharePoint views: Display selected columns, apply filtering, grouping, and totals configured in SharePoint.
  • Related document libraries: Display related documents, upload multiple files, and work with document properties.
  • Additional customization: Apply dynamic filtering, customize the appearance of columns, and adjust the control's behavior with JavaScript.

Unlike the Power Apps approach, you don't need to create a collection or write custom formulas to track new, modified, and deleted records.

How to configure the List or Library control

Let's use the same Purchase Requests and Purchase Items lists.

We've already created the Lookup column in Purchase Items, so the relationship between the lists is ready.

Here's how to configure it:

  1. Open the Plumsail Forms designer for the Purchase Requests list.

  2. Add the List or Library control to the parent form, below the general request fields.

  3. Select the data source. In the control settings, choose Purchase Items as the source list.

  4. Configure the Lookup field. Select the Purchase Request column that links child items to their parent.

  5. Choose a SharePoint view. You can create a view in the Purchase Items list containing Product, Quantity, and Unit Price, and use it in the control.

  6. Select an editing mode. With Inline editing, employees can modify products directly in the table. With Dialog editing, each product opens in a separate form.

  7. Save and test the form.

Plumsail List or Library control configuration  

That's the main setup.

When an employee opens an existing purchase request, the control automatically displays the products linked to that request.

When creating a new request, the employee can add multiple products to the List or Library control. Plumsail handles saving the parent first and linking the new child items using the Lookup column.

Plumsail Forms - Purchase request form with related products  

For a basic setup, you don't need code to create or update records or link child items to the parent request. The control handles all of that automatically.

If you prefer dialog editing, you can also customize the child list's New, Edit, and Display forms to control which fields users see when adding or modifying a product.

For detailed instructions, see How to create a SharePoint form with associated items or documents and bind new ones automatically or watch the video tutorial:

 

Pros and cons of Plumsail's List or Library control

The List or Library control handles most of the routine work involved in creating and managing related SharePoint records.

Advantages:

  • Minimal configuration for standard parent-child relationships.
  • No need to write formulas for saving related items or assigning parent IDs.
  • Built-in functionality for adding, editing, and deleting records.
  • Inline editing without building a custom gallery or separate editor.
  • Support for related SharePoint document libraries and file uploads.
  • Reuse of SharePoint views for displaying and organizing records.

Limitations:

  • Separate licensing: Plumsail Forms is a third-party product and requires its own subscription.
  • Control-based interface: You work with the built-in control's functionality rather than creating an entirely custom Power Apps interface adapted to your needs.
  • Advanced customization: Scenarios outside the standard control behavior may require JavaScript or additional configuration.

For a straightforward purchase request form, the List or Library control is easier to configure. But Power Apps provides more freedom if you need a fully custom application with interactions that go beyond working with related SharePoint records.

Miroslav Lengyel
We keep track of material transfers between construction sites in one place, monitor consumption, and can process invoicing faster thanks to the information entered in [Plumsail Forms].
Read how Profibaustoffe CZ manages construction logistics in SharePoint Online →
Miroslav Lengyel,
Logistics Specialist at Profibaustoffe CZ

Public form with related SharePoint items

Plumsail public forms has the List or Library control for a public form that has a direct SharePoint connection.

This opens up similar scenarios for users who don't have access to your SharePoint site.

For example:

  • Purchase orders: Customers submit orders containing multiple products.
  • Supplier onboarding: Suppliers provide company details and several contact persons.
  • Project requests: External partners submit a project request with multiple tasks or deliverables.
  • Event registration: Organizers collect group registrations with multiple participants.

You can configure the form to save the main submission to one SharePoint list and use List or Library to collect related records in another list.

For new submissions, users can add related items. When editing an existing submission, they can also view and modify the items already linked to it.

One useful detail is that changes made through the List or Library control are applied only when the public form is submitted. New child records are linked automatically to the parent item after submission.

Power Apps vs. Plumsail Forms: Which approach should you use?

Both solutions let users work with records from multiple SharePoint lists without manually switching between them.

The main difference is how much functionality you need to configure yourself.

Choose Power Apps if you want full control over the interface or need complex interactions between multiple data sources. You'll also need the expertise to build and maintain Power Fx logic.

Choose Plumsail Forms if your main requirement is to create, display, and manage related SharePoint items without developing the underlying parent-child logic yourself. Plumsail public web forms also lets you collect related records from external users without giving them access to your SharePoint site.

Build SharePoint forms with related items

Creating related SharePoint list items with Power Apps is possible using Lookup columns, Data Grid, galleries, and Power Fx. Power Apps gives you flexibility in how records are displayed and edited. However, you need to configure how parent and child items are saved and linked, including error handling. This requires development time and knowledge of Power Fx.

Plumsail Forms offers a simpler approach with its List or Library control. You can configure the relationship between SharePoint lists, add the control to the parent form, and let users manage related items without writing custom save logic. If you need similar functionality for external users, Plumsail public forms can also collect related records without requiring access to your SharePoint site.

Start a free trial of Plumsail Forms and see how the List or Library control can work for your scenario involving related SharePoint items.