cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SCTdan
Level 8

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
Community Support Team
Community Support Team

Re: Screen resetting to wrong record after updateif

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.
1 REPLY 1
Community Support Team
Community Support Team

Re: Screen resetting to wrong record after updateif

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
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 175 members 4,510 guests
Please welcome our newest community members: