cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
daniels471
Helper II
Helper II

Trouble with update patch

so I have a galley which im trying to update items in the SharePoint list based on a dropdown in the gallery .

 

i get the following error 

daniels471_0-1620981129718.png

 

here is my code from the one im having trouble with .

 

ForAll(
    Gallery1.AllItems,
    Patch(DB,ThisRecord
        ,
        {
        Status: Dropdown2.SelectedText.Value
        }
    )
);

 

 

I have however used pretty much the same code in another app and that works fine ,

 

here's the code from the working app 

 

 

ForAll(
    Gallery2_1.AllItems,
    Patch(Rooms,ThisRecord
        ,
        {
            Admin: ThisRecord.Toggle1.Value,
            SLT: ThisRecord.Toggle1_1.Value,
            'Office-Admin': ThisRecord.Toggle1_2.Value,
            Basic: ThisRecord.Toggle1_3.Value
        }
    )
);

 

6 REPLIES 6
CNT
Super User
Super User

@daniels471 what's the error that u see?

sorry thought i attached a picture of it 

it says 

"the specifed record was not found. Server Response: DB failed: Item Not Found " it then included the client request id and the service request id

CNT
Super User
Super User

@daniels471  Is the Data Source for Gallery1 the same as the one in the Patch? Is the Data Type for Status sting in the DB?

ah , forgot that bit , gallery1 is getting its data from another list

andrii1z
Frequent Visitor

@daniels471 , Are you trying to patch the SP Choice status field?

If so you need to update that field in the following way:

 

ForAll(
    Gallery1.AllItems,
    Patch(DB,ThisRecord
        ,
        {
        Status:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:Value:Dropdown2.Selected.Id,Value:Dropdown2.Selected.Value}
        }
    )
);

 

And you can use the following structure in your Dropdown field's Items property to get the right Id and value on selection:

 

Choices(DB.Status)

 

 

no its just a string colum

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,271)