cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IzzyWizz
Resolver I
Resolver I

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

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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