web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue patching gallery...
Power Apps
Answered

Issue patching gallery entries to secondary list

(0) ShareShare
ReportReport
Posted on by 85

I have an app with the main form and a child list. I'm trying to save the collection records to the child list of the app. The foriegn key in the child list is named 'Parent' and is a lookup field to the main forms 'ID' field. The main form submits successfully, however the child records do not submit. The error is below:

 

"The type of this argument 'Parent' does not match the expected type 'Record'. Found type 'Number'"

 

My formula is below:

ForAll(OrderDetail,Patch('Construction Order Detail', Defaults('Construction Order Detail'), {Title: Manufacture, 'Item Description': Description, 'Item Master Number': Master, 'Quantity Requested': Quantity, 'Parent': 'CXM Form'.LastSubmit.ID})

 

Also, when I preview the form an empty blank record is present in the gallery, Im not sure why that's happening either.

 

Categories:
I have the same question (0)
  • cmyoung07 Profile Picture
    125 on at

    I usually use set a variable to my patch results and then use that to reference the id.

    Set(varNewItem, Patch(<Main Patch Logic Here>));

     

    Then use the variable results in your other expression, so replace 'Parent': 'CXM Form'.LastSubmit.ID} with Parent: varNewItem.ID,

     

    Also check your quotes in your child patch expression, the field names should not be in quotes, so 'Parent' should be Parent.

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    @ShawnPelletier 
    The reason you're getting the is error is Parent is a lookup so try this on form success 

     

     

    Set(
     gblLastSubmitted,
     Self.LastSubmit
    );
    
     Patch(
     ParentList,
     Defaults(ParentList),
     {
     Title: gblLastSubmitted.Title,
     'Parent': {
     Value: gblLastSubmitted.ID,
     Id: gblLastSubmitted.ID
     }
     }
     );

     


     Try this on your end

    Set(gblLastSubmitted,Self.LastSubmit);
    ForAll(OrderDetail,Patch('Construction Order Detail', Defaults('Construction Order Detail'), {Title: Manufacture, 
    'Item Description': Description, 
    'Item Master Number': Master,
    'Quantity Requested':Quantity,
    'Parent':{Value: gblLastSubmitted.ID,Id: gblLastSubmitted.ID}
    });
    
    
    



  • ShawnPelletier Profile Picture
    85 on at

    Here is what I'm running into now when trying to use the above:

    ShawnPelletier_0-1668624101537.png

    I renamed the child list fields to one word names to avoid issues and confusion with spacing, etc. This code is placed in 'OnSuccess' of the main form submission.

     

    Also, If I'm correct:

    Title: refers to child list column name

    : 'Manufacturer Part #' refers to the gallery column name assigned to 'Title'

     

    Where and how do the collection column names map into this? 

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    @ShawnPelletier 
    Show me a screenshot of your backend SharePoint columns something not right. 

  • ShawnPelletier Profile Picture
    85 on at

    OrderDetail (collection):

    ShawnPelletier_0-1668719412056.png

     Construction Order Detail (child list):

    ShawnPelletier_1-1668719571029.png

     

     I'm trying to patch:

    iDescription > Description

    iManufacturer > Title

    iMaster > Master

    iQtyOrdered > Requested

    ID of Master form > Parent

     

    Let me know if you need additional screenshots. Thank you.

  • Verified answer
    Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi@ShawnPelletier 
    You are missing 'Parent' 

     

     

    Set(
     gbllastSubmitted,
     Self.LastSubmit
    );
    Patch(
     'Construction Order Detail',
     Defaults('Construction Order Detail'),
     {
     Title: "Manufacturer Part #",
     'Item Description': "Test description",
     Requested: "10",
     'Parent': {
     Value: gbllastSubmitted.ID,
     Id: gbllastSubmitted.ID
     }
     }
    )

     

     

    You don't need to use again Form.LastSumit as we have already captured on the variable gbllastSubmitted.
    I will recommend you change the name parent to ParentLookup as the Parent normally used within PowerApps formulas. for example,

     

    Set(
     gbllastSubmitted,
     Self.LastSubmit
    );
    Patch(
     'Construction Order Detail',
     Defaults('Construction Order Detail'),
     {
     Title: "Manufacturer Part #",
     'Item Description': "Test description",
     Requested: "10",
     ParentLookup:
     {
     Value: gbllastSubmitted.ID,
     Id: gbllastSubmitted.ID
     }
     }
    )

     





Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard