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 / Patch a column, withou...
Power Apps
Answered

Patch a column, without user intervention, to a Collection from a Gallery field where Item comes from a LookUp from a different table.

(0) ShareShare
ReportReport
Posted on by 79

Hi and thank you for any guidance! I have a canvas app screen where users review, edit and approve sets of data. The user first selects the header record from a form, and then a gallery becomes visible that shows the detail rows for the record. Filtered detail data populates a Collection via the screen's OnVisible property, and further filtered Collection items populate the Gallery. The header and detail data reside in 2 different SharePoint Lists. The user can edit the columns in each detail row, utilizing a Form. When the user selects the Approve button, the SubmitForm function is triggered to update the header SharePoint List, and OnSuccess of the Form, a new row is created in a Dataverse table. 

cpill1220_0-1702907979081.png

I've added a new 'ContractItem' column to the Dataverse table, and am hoping to populate this column from a virtual Dataverse table created from an on-premise SQL database. This data element isn't relevant to the users who approve the other data in the screen and won't be visible or edited by the 'approver' user. So far, I haven't been successful with my modification of the OnSuccess Patch statement to get the new Dataverse column to populate. I DO have the data populating the Gallery correctly, and when I select the Edit button, and then the Update Row button, the Collection populates correctly, and THEN the Approve button correctly populates the Dataverse table column. But the users normally won't edit rows before selecting the Approve button, so I need to have the new ContractItem: populate the Collection some other way before the Approve button is selected. 

 

The statement that populates the Gallery field is:  LookUp(CNC_ACTIVE__CONTRACT_ITEM, Contract = LookUp(DailyActivityMaster, ID = ThisItem.MasterID,'Job Number') && Misc_1 = ThisItem.Action.Value && Misc_2 = "CC", Description)                  CNC_ACTIVE__CONTRACT_ITEM is the virtual Dataverse table, and DailyActivityMaster is the SharePoint List that stores the header data on the screen.

 

The UpdateRow button statement (after selecting Edit on the Gallery row) is: 

Patch(colGridData, {ID:DetailGalleryNew_1.Selected.ID}, {Action: Actionedit_1.SelectedText , State: Stateedit_1.SelectedText, ItemType: ItemTypeedit_1.SelectedText, ItemCode: ItemCodeedit_1.SelectedText, Pieces: Value(Piecesedit_1.Text), SFBFt: Value(SFBFtedit_1.Text), From: Fromedit_1.Selected.Location , To: Toedit_1.Selected.Location, OtherOwned: If(Checkbox2.Value=true, "Yes", "No"), Remarks: Remarksedit_1.Text, WorkLocation: tiWorkLocation.Text, ContractItem: lStdContItem.Text, BillableDefault: If(cbBillable.Value=true, "Yes", "No"), BillableApproved: If(cbBillable.Value=true, "Yes", "No"), ID: Value(ID_1.Text), MasterID: DetailGalleryNew_1.Selected.MasterID}); UpdateContext({ShowFormDetails: false, NewBlankRow: false}); Set(NeedSaved, false);

 

How could I trigger the Collection's ContractItem: populating from the Gallery field without requiring the user to do anything other than selecting the Approve button? I hope this makes sense. 

 

Thank you again. 

 

Categories:
  • Verified answer
    scalca Profile Picture
    on at

    at which point do you want that column to be updated with data ? 
    so basically I did understand that you want to populate data to the collection contract item column coming from SQL Table after the item was created in dataverse is that correct ? 

    why are you not using a power automate flow triggered when a new item was created to get data from SQL and update the row ? it can be even triggered from your power app itself whenever you create the item then run the flow for example

  • cpill1220 Profile Picture
    79 on at

    Thank you for the reply. I will try that. 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard