web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problem with two seque...
Power Apps
Answered

Problem with two sequencial patch

(1) ShareShare
ReportReport
Posted on by 50

Hello everyone

I have a trigger that patches two different lists in SharePoint.

The second patch uses the data entered/updated by the first patch.

Sometimes (due to network problems?) the second patch retrieve old list data (not yet patched by the first patch). 

It seems that the second patch fires before the first one ends....

Any suggestions?

Categories:
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @EmMa73 You'll need to check for stale data in this case.

    You may need to have something in the first Patch that the second patch knows that it has been patched - maybe even a dedicated column for this purpose whose value is always set to "Patch1" or something like that when first patch was successful.

    For the Second Patch, use it inside a Timer which will retry on say 1 second intervals and have formula OnTimerEnd and repeat set to true, and duration of 1000 (milliseconds) - if the data uniquely identifying First Patch success e.g. "Patch1" cannot be found in that column, then it must retry this patch again for a few times until it is found.

    After a max number of times, it should just stop and show some error instead.

    If the second patch go through it should not take out "Patch1" from that column altogether.

    In similar vein, if Patch1 should not even happen if another concurrent Patch1 was done but not Patch2 yet, then this can be checked as well to avoid another kind of inconsistency as well.

     

    The above sound kind of hard I know, but it is only way I know of to be sure.

    If someone else have simpler idea, I welcome it, please reply as I would like to know if it to keep in mind as well.

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @EmMa73 Besides the idea I have another one. You can force it so user input is required. If first patch doesn't go through by network problem, you never proceed to the next step to begin with. This next step could be another screen with another button to put more input inside of it and then to press it for the second patch. 

     

    If it is not acceptable for the First Patch to happen without the Second Patch or vice versa, I guess the hard way might be best. It might be necessary to be able to undo the Patch too. You may need to go so far as to make a little bit of custom transaction log where you can roll and unroll the sequence. If an operation to edit was made, and not another one, eventually the first one may lock up on purpose and not allow further edit. After a max tie, it will unroll the operation and go back to how it was before to avoid stale or intermediate states (maybe this can be done with a Recurrence Flow from Power Automate) - the harder idea I put originally is sort of like this - except it will just lock in that version and never reset either. 

     

    Also instead of making them in sequence try to just nest the Patches - maybe this just works too (careful though - I wouldn't do it this way - this is in case to consider if it works for you as workaround for some reason and in some specific way).

  • EmMa73 Profile Picture
    50 on at

    Hi @poweractivate ,

    the second solution does not solve my requirements (user input is required only on the first patch).

    I have to think if the first solution is possible..... I will let you know.

     

    Do you know if inserting the patch in a collection solves the problem? Is it true that powerapps moves to the next action only if the collection has been built?

     

    I would try this:

     

    ClearCollect(firstpatch, Patch (first list, ...));

    //second patch

    Patch (second list, ....);

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @EmMa73 You could definitely try that as well, maybe it will work.

    Go ahead and try it.

    The problem is, I really am not sure that  it will be different from before though, but you could give it a try.

    I suspect you will get the same problem though.

  • EmMa73 Profile Picture
    50 on at

    @poweractivate 

    I will try because if it worked it is much easier.

     

    Unfortunately it is difficult to do a test because the problem does not always happen but (perhaps) only when network is very slow.

  • Verified answer
    EmMa73 Profile Picture
    50 on at

    I did many tests and it seems to work call the first patch inside the collection.

    It seems like PowerApps waiting for the collection to be built before moving on to the next action, but I'm not sure. Maybe today the network was simply faster

    Any way, it would be nice to have in PowerApps a function like Wait...Until

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 383 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 356

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard