cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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
Community Support Team
Community Support Team

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.

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
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,001)