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
Community Champion
Community Champion

@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
Community Champion
Community Champion

@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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,221)