Search code examples
powerappspowerapps-formula

Powerapps UpdateContext after Patch


I have a 'Sign Up' button in my app that adds the logged in user into a sharepoint list. The code (which works perfectly) is currently -

Patch(
    EVENTPARTICIPANTS;
    Defaults(EVENTPARTICIPANTS);
{
   EVENTID: Gallery3.Selected.EVENTID;
  NAME:{
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
            Department: "";
            Claims: "i:0#.f|membership|" & User().Email;
            DisplayName: User().FullName;
            Email: User().Email;
            JobTitle: "";
            Picture: User().Image
        }
 }
 )

I'm trying to figure out how to add an updateContext after it, so my confirmation popup box will be visible, but I can't get the syntax right.

Can someone please tell me why this doesn't work? Thanks!

Patch(
    EVENTPARTICIPANTS;
    Defaults(EVENTPARTICIPANTS);
{
   EVENTID: Gallery3.Selected.EVENTID;
  NAME:{
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
            Department: "";
            Claims: "i:0#.f|membership|" & User().Email;
            DisplayName: User().FullName;
            Email: User().Email;
            JobTitle: "";
            Picture: User().Image
        }
 }
 )
;
 UpdateContext({varShowPopup:true})

Solution

  • Use this formula:

    Patch(
        EVENTPARTICIPANTS;
        Defaults(EVENTPARTICIPANTS);
        {
            EVENTID: Gallery3.Selected.EVENTID;
            NAME:{
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
                Department: "";
                Claims: "i:0#.f|membership|" & User().Email;
                DisplayName: User().FullName;
                Email: User().Email;
                JobTitle: "";
                Picture: User().Image
            }
        }
    );;
    UpdateContext({varShowPopup:true})
    

    It should work for you!