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 statement with e...
Power Apps
Unanswered

Patch statement with embedded lookup statement not updating SharePoint list column

(0) ShareShare
ReportReport
Posted on by 455

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

Categories:
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    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

  • lumberjacklurch Profile Picture
    455 on at

    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.

     

     

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 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard