cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IzzyWizz
Helper IV
Helper IV

Patch to update a record in a Sharepoint list

Hi,

I have a SharePoint list that I use to collect data from onsite audits. I have a gallery that displays the completed audit information where you can click though to display the details from a selected gallery item:

AuditGallery.jpg

The Action Required box on the second screen is populated from the background SharePoint list for the selected item:

AuditGalleryPage2.jpg

I have a Patch function on the update button that I want to update the Audit Type and Action Required (you can't change the image at the moment, that will be phase2!). The code is below:

Set(
    varPatchAudit2,
    Patch(
        'Hygiene Fabrication Audits',
        Defaults('Hygiene Fabrication Audits'),
        {
           
            AuditType: Dropdown1_1.Selected.Value,
            Title: Dropdown1_1.Selected.Value,
            ActionRequired: ActionRequiredInput_1.Text,
            TaskStatus: "Not started",
            AssignedBy: If(
                Dropdown1_1.Selected.Value = "Fabrication",
                FabManager,
                HygManager
            ),
            AssignedTo: "Unassigned"
            
        }
    )
);

My problem is that it is that the update is not registering anything new, i.e. if I change the Audit Type via the dropdown or the text in the Action Required, the background list is not changing. Either the Patch is not working or it is putting back the same information without picking up the changes.

Any ideas what I am doing wrong?

Thanks,

Izzy.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @IzzyWizz ,

If you want to update the existing record on change then Instead of Default you can use like below.
You need to Pass the ID of that record that you want to Update. 
For reference - See below Image

VijayTailor_0-1601892583195.png

 

Thanks,

Vijay

View solution in original post

3 REPLIES 3
VijayTailor
Resident Rockstar
Resident Rockstar

Hi @IzzyWizz ,

As I can see in the below-mentioned Code is like you are patching the Choices Field but you Passing value like a text.
SO If your Source having FIeld "AuditType" is Choice Field then you can Patch Value Like Below.

AuditType:{
            Value:"Submitted",
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
        }

The same thing is Applicable to Person Field also.
Like for the Field -  Field (If your Source Having "AssignedBy" field as a Person or Group Type)

//AssignedBy
AssignedBy: {
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                Claims: "i:0#.f|membership|"&Lower(User().Email),
                DisplayName: User().FullName,
                Email: Lower(User().Email),
                Picture: User().Image,
                Department: "",
                JobTitle: ""

              }


Thanks,
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."



Hi,

No, Audit Type is a text field, I just use a dropdown to limit the options for the text that people can input. I want the text that I have already patched to the Audit Type and Action Required fields to be updated with the new information, replacing what has successfully patched there previously.

Izzy.

Hi @IzzyWizz ,

If you want to update the existing record on change then Instead of Default you can use like below.
You need to Pass the ID of that record that you want to Update. 
For reference - See below Image

VijayTailor_0-1601892583195.png

 

Thanks,

Vijay

View solution in original post

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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (1,489)