cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SCTdan
Continued Contributor
Continued Contributor

Screen resetting to wrong record after updateif

I've got a screen to display properties/details from a gallery.  This data is dumped into a collection via flow connecting to our ticket system via API.

 

I want to be able to edit the fields from here, which is functional insomuch as it updates the ticket in our ticket system.

 

The issue I'm trying to solve is that, upon submitting the changes, the actual ticket details will not update.  Not unexpected, I have to trigger a flow with the changes, which would then require refreshing the tickets via API.  If I go to the main gallery and refresh, I see the changes reflected.

 

 

For the gallery, I have the current field value in there as a label.  I have a dropdown overlaid, Visibile controlled by an icon to toggle show/hide.  That dropdown list is populated by a sharepoint list.  If a change is made, a save icon will be displayed.  Click that, a flow is triggered to update it in our ticket system, edit/save/dropdown visibility variables are reset.  So the dropdown will show the new value, but by hiding that dropdown, it goes back to showing the label with the "old" status.

 

My idea to get around that is to modify the collection with the changes so they are immediately updated (i think they should at least?), and the next full refresh will simply overwrite the whole collection with the same (as displayed) data.  For this I'm trying to use UpdateIf, which seemed the most appropriate function since only 1-3 of the 8 record fields will be updated.

 

 The issue is that when clicking the checkmark icon here to submit, it will reload the screen with the first record from the collection.  However, if I click on the refresh icon on this screen, it'll load the ticket comments, and it will still load the comments from the correct ticket. (Additional functions removed from onselect for clarity here, UpdateIf is the only action here)2018-12-04 13_06_15-RS Mobile - Saved (Unpublished) - PowerApps.png

 

In action-

rsmobile2.gif

 

Hopefully that makes sense, bit messy since I've been messing with it.  Any clue what could be causing that?  Is there a better way to achieve this considering I'm not working with sharepoint/cds data?  

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @SCTdan,

Could you please share a bit more about your scenario?

Which data source does your Gallery connect to? A Collection or a SP list?

Could you please share more details about the Tickets data source? Is it a Collection or a SP list?

Based on the GIF screenshot that you mentioned, when you click the checkmark icon to submit your changes, the displayed record within your gallery is not the record you edit before.

I suppose that the Gallery is connected to your Collection, is it true?

Based on the formula that you provided, I don't find any syntax error with it. Please consider take a try to add a formula as that in your Refresh icon within the OnSelect proeprty of the "Checkmark" icon to refresh your Collection data.

Please take a try with the following wrokaround:

Set the OnSelect property of the "Checkmark" icon to following:

UpdateIf(Tickets, Ticket_ID = ThisItem.Ticket_ID, {Ticket_Status: DD_StatusEdit.Selected.Value});
Refresh('YourSPList');
ClearCollect(Tickets, 'YourSPList')

Note: I assume that the Tickets represents the Collection that you mentioned within your app.

then check if the issue is solved.

In addition, you could also consider take a try to achieve your needs with Patch function. The standard formula as below:

Patch(Tickets, LookUp(Tickets, Ticket_ID = ThisItem.Ticket_ID), {Ticket_Status: DD_StatusEdit.Selected.Value});
Refresh('YourSPList');
ClearCollect(Tickets, 'YourSPList')

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @SCTdan,

Could you please share a bit more about your scenario?

Which data source does your Gallery connect to? A Collection or a SP list?

Could you please share more details about the Tickets data source? Is it a Collection or a SP list?

Based on the GIF screenshot that you mentioned, when you click the checkmark icon to submit your changes, the displayed record within your gallery is not the record you edit before.

I suppose that the Gallery is connected to your Collection, is it true?

Based on the formula that you provided, I don't find any syntax error with it. Please consider take a try to add a formula as that in your Refresh icon within the OnSelect proeprty of the "Checkmark" icon to refresh your Collection data.

Please take a try with the following wrokaround:

Set the OnSelect property of the "Checkmark" icon to following:

UpdateIf(Tickets, Ticket_ID = ThisItem.Ticket_ID, {Ticket_Status: DD_StatusEdit.Selected.Value});
Refresh('YourSPList');
ClearCollect(Tickets, 'YourSPList')

Note: I assume that the Tickets represents the Collection that you mentioned within your app.

then check if the issue is solved.

In addition, you could also consider take a try to achieve your needs with Patch function. The standard formula as below:

Patch(Tickets, LookUp(Tickets, Ticket_ID = ThisItem.Ticket_ID), {Ticket_Status: DD_StatusEdit.Selected.Value});
Refresh('YourSPList');
ClearCollect(Tickets, 'YourSPList')

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,409)