cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Patch statement with embedded lookup statement not updating SharePoint list column

I am currently working on a form ("Form1") with a combobox.  The combobox items are populated by the title column of a collection ("col_Departments").  What I am trying to do, is after SubmitForm runs, patch the lastsubmitted record by grabbing a column value from the collection and placing in the column of the record ("DeptID") in the SharePoint list ("Requests").  Here's my code:

 

Patch(Requests,Form1.LastSubmit, {DeptID: (LookUp(col_Departments,combo_DepartmentValue.Selected.Title in Title, ID))})

 

I must note that I DO NOT have the datacard for the DeptID active in the form.

I must also note that I fixed this by adding the datacard to the form and assigning the lookup value to it.  However, I don't understand why the Patch statement wouldn't work.

 

Thanks

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Patch statement with embedded lookup statement not updating SharePoint list column

Hi @lumberjacklurch,

Could you please share more details about your col_Departments collection?

Which column does your Combo Box control relate to within your Edit form?

Based on the formula that you provided, I think there is something wrong with it. After executing SubmitForm() function, your Edit form would be reset, so your combo_DepartmentValue (Combo Box) would be reset, the combo_DepartmentValue.Selected.Title formula would return Blank.

I have made a test on my side, please take a try with the following workaround:4.JPG

Set the OnVisible property of the first screen of my app to following:

ClearCollect(
col_Departments,
{ID:"1001",Title:"PowerApps"},
{ID:"1002",Title:"Microsoft Flow"},
{ID:"1003",Title:"Power BI"}
)

Set the Items property of the Combo Box control within the DepartmentName Data card to following:

col_Departments.Title

Set the OnSelect property of the "Submit" button to following formula:

SubmitForm(EditForm1);
Patch(
'20181109_case7',
EditForm1.LastSubmit,
{
DeptID: LookUp(col_Departments, EditForm1.LastSubmit.DepartmentName in Title, ID)
}
)

On your side, you should modify your Patch function as below:

Patch(
     Requests,
     Form1.LastSubmit,
     {
       DeptID: LookUp(col_Departments, Form1.LastSubmit.DepartmentValue in Title, ID)
     }
)

Note: The DepartmentValue represents the column in your Requests list, which is related to the Combo Box control (combo_DepartmentValue).

The GIF screenshot as below:Test1.gif

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Patron
Post Patron

Re: Patch statement with embedded lookup statement not updating SharePoint list column

Kris,

Thank you for the reply.  I finally got it to work.  I added the Dept ID datacard to the form and changed it's Default field to the lookup formula.  Now SubmitForm grabs the ID.

 

 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,171)