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 / Patching a Collection ...
Power Apps
Unanswered

Patching a Collection text value to a drop down record

(0) ShareShare
ReportReport
Posted on by 49

Hoping for some help here everyone. This app was working, but at some point has stopped, and now the code is wrong.  

 

I have a gallery (bottom section) where users can add line items. When the user clicks the green check mark it submits to a Collection successfully (patch code below).

 

 

 

Patch(
	colExpenses, 
		ThisItem, 
			{
				LineDate: lineDate.SelectedDate,
 LineSupplier: lineSupplier.SelectedText.Value, 
				LineItemDesc: lineDescription.Text, 
				LineFunding: lineFunding.SelectedText.Value, 
				Line_Cost: Value(lineCost.Text)
			}
); 

Collect(
	colExpenses,
		{
			LineDate: Today(), 
			LineSupplier: "", 
			LineItemDesc: "", 
			LineFunding: "", 
			Line_Cost: 0,
 MasterID: ""
		}
);

 

 

 

 

 

CollectionPatchSuccess.jpg

 

When the user completes all required fields the Submit button is active. The button submits the form (top half), then on the forms OnSuccess property I have the below code to Patch the Collection to the SharePoint List.

 

 

 

//Patch (save) all line item expenses
ForAll(
 colExpenses, 
 If(!IsBlank(LineItemDesc), 
 Patch(
 ItemizedList, 
 Defaults(ItemizedList), 
 {
 DateOfActivity: LineDate,
 //Suppliers: LineSupplier,
 ItemDescription: LineItemDesc,
 Cost: Line_Cost,
 //FundingSources: LineFunding,
 MasterID: formMiscExpense.LastSubmit.ID
 }
 )
));
Refresh(ItemizedList);

 

 

 

And this is what is submitted to the list:

Submitted.jpg

 

Here is a bit of further info:

 

Properties:

  • Gallery's Data Source: colExpenses
  • Supplier Drop Down
    • Name: lineSupplier
    • Default: ThisItem.LineSupplier
    • Items:  Sort(Suppliers.Title,Descending)     ("Suppliers" is another list that I lookup from)
  • Funding Drop Down
    • Name: lineFunding
    • Default: ThisItem.LineFunding
    • Items: colFunding (this is a collection that populates on AppStart from another SharePoint List called 'FundingSources'

 

I get no errors on the app, but it is not submitting properly, as it used to. So it patches to the Collection great. Its just not patching to the 'ItemizedList' SharePoint list Properly. 

 

Any help is appreciated, and thank you in advance to this great community!

 

Eric

Form.jpg
Submitted.jpg
CollectionPatchSuccess.jpg
Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @ezjensen ,

    Could you please share a bit more about your scenario?

    Is there something issue with the "Suppliers" column value and "FundingSources" column value?

    Could you please share a bit more about "Suppliers" column and "FundingSources" column in your ItemizedList List? Are they Person type column and Choice type column?

     

    If the  "Suppliers" column and "FundingSources" column are both Text type column in your ItemizedList List, I think the ForAll formula that you provided is correct. Please also consider modify your formula as below:

    ForAll(
     colExpenses, 
     If(
     !IsBlank(LineItemDesc), 
     Patch(
     ItemizedList, 
     Defaults(ItemizedList), 
     {
     DateOfActivity: colExpenses[@LineDate],
     //Suppliers: colExpenses[@LineSupplier],
     ItemDescription: colExpenses[@LineItemDesc],
     Cost: colExpenses[@Line_Cost],
     //FundingSources: colExpenses[@LineFunding],
     MasterID: formMiscExpense.LastSubmit.ID
     }
     )
    ));
    Refresh(ItemizedList);

     

    If the "Suppliers" column is a Person type column, and the "FundingSources" column is a Choice type column in your ItemizedList List, I think there is something wrong with your formula. Please consider modify your formula as below:

    ForAll(
     colExpenses, 
     If(
     !IsBlank(LineItemDesc), 
     Patch(
     ItemizedList, 
     Defaults(ItemizedList), 
     {
     DateOfActivity: colExpenses[@LineDate],
     Suppliers: {
     Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUser(), DisplayName = colExpenses[@LineSupplier], Mail)),
     DisplayName: colExpenses[@LineSupplier],
     Email: LookUp(Office365Users.SearchUser(), DisplayName = colExpenses[@LineSupplier], Mail),
     Department: "", 
     JobTitle:"", 
     Picture:""
     },
     ItemDescription: colExpenses[@LineItemDesc],
     Cost: colExpenses[@Line_Cost],
     FundingSources: {
     Value: colExpenses[@LineFunding]
     },
     MasterID: formMiscExpense.LastSubmit.ID
     }
     )
    ));
    Refresh(ItemizedList);

    Note: You need to add Office 365 Uses connection in your app.

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • ezjensen Profile Picture
    49 on at

    @v-xida-msft Thank you for the reply.

     

    • 'Suppliers' is just a list with company names in the Title column
      • ex. Microsoft, Dell, HP, etc.
    • 'FundingSources' is just a list with places that money can come from. 
      • ex. Source 1, Source 2, Source 3, Etc.

    These are both columns in the 'ItemizedList' that lookup values from the respective list

     

    Issue: The Suppliers and Funding sources fields are not being patched from the Collection for some reason.  This code lies in the OnSuccess property of the form.  The data is Patching correctly from the fields to the Collection, just not from the Collection to the SharePoint list 'ItemizedList'

     

    Based on the field types I think your proposed solution 2 is more the method to approach with since there are no people values.

     

    I tried this solution, with no resolution. I am getting the below error on both the Suppliers and FundingSources lines.MS-SupportTeam-KrisDai.jpg

    //Patch (save) all line item expenses
    ForAll(
     colExpenses, 
     If(!IsBlank(LineItemDesc), 
     Patch(
     ItemizedList, 
     Defaults(ItemizedList), 
     {
     DateOfActivity: LineDate,
     Suppliers: {Value: colExpenses[@LineSupplier]},
     ItemDescription: LineItemDesc,
     Cost: Line_Cost,
     FundingSources: {Value: colExpenses[@LineFunding]},
     MasterID: formMiscExpense.LastSubmit.ID
     }
     )
    ));
    MS-SupportTeam-KrisDai.jpg

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard