cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

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
Highlighted

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
Highlighted
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."



Highlighted

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.

Highlighted

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

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (13,957)