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

Controls not updating after patching a SharePoint item

Hi everyone, this is my first post here. I'm new to PowerApps and have been given the task of creating a support portal where customers would log a ticket in a SharePoint list and the support team would then process the ticket via a canvas app in MS Teams.

The app's homescreen is a gallery that shows all the tickets, clicking on a ticket takes you to a new screen where the various SharePoint fields are shown in labels. I am not using a form because the idea is the support team must process the tickets following a predefined process and thus should not be able to edit any of the fields directly. Rather, depending on the ticket status different buttons will be active that will update the different fields.

The problem I'm running into is that after patching a field the change is not reflected in the label on the screen. It's only after I navigate back to the homescreen and click on the ticket again that I see the updated information.

Things that you'll want to know:

The OnSelect property of my gallery is set to:

 

Set(varItem,ThisItem);Navigate(scrTicketDetails)

 

You can see I'm not using the gallery.Selected method because this caused the selected item to change to the first item in the gallery after patching, also mentioned in this post. Setting the selected item to a variable solves that, at least.

The OnSelect property of the button that "Activates" the ticket is set to:

 

Patch(
    Externals2,
    varItem,
    {Status:
        {
        Value: "Active",
        '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}
        }
    )

 

Where 'Externals2' is the name of the SharePoint list. What the button does is just setting the Status field (which is a Choice column) to "Active". Apparently, updating a choice column in a SP list requires the '@odata' part. The patching works fine, the status of the ticket is, in fact, updated to "Active" when I press the button. It's just that that change is not reflected right away in the label on the screen that displays the status.

The Text property of the label in question is simply:

 

"Status: "&varItem.Status.Value

 

I've been trying all sorts of things to try and simply "refresh" the label in question to get it to show the updated information after clicking the button without having to navigate back to the gallery and reselecting the item, but I've been unsuccessful, unfortunately. I've also not been able much information regarding this problem on the internet. I'm hoping that someone on this forum has come across this problem and has a simple way to fix it. 

Mind you, it's not just that label that has that problem. I have the same problem with all labels on the screen that show the different fields of the SP list. So the problem does not lie with the label, it lies in the fact that patching the SP list causes the gallery to refresh, which in turn causes the varItem variable to be "lost", I think? Any help would be greatly appreciated.

0 REPLIES 0

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (20,091)