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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,246)