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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ForAll patch sequence ...
Power Apps
Answered

ForAll patch sequence numbers issue

(0) ShareShare
ReportReport
Posted on by

Hi All,

 

I am having some issue in duplicating and patching records multiple times using different browser or different user doing the same operation at the same time. It works fine when duplicating 1 record at time or using same browser however issue occurs when using different browser or different users at the same time, it starts repeating application number. e.g. let's say last saved record number is SW-00082 and I need to duplicate 5 records but at the same time different user trying to do same thing on different record, that's when it start repeating please refer below example.

 

 

asif082_1-1642477765175.png

 

 

Below is code. 

 

asif082_0-1642474638504.png

If anyone can help me with above issue that would be great please.

 

 

 

Categories:
I have the same question (0)
  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    You'll need to utilize you primary id key for the table for the entries and at the end of the patch get the return id value, then process the Generated ID from that. This way you get a unique ID on the insert to utilize. Trying to generate the ID from code at runtime doesn't let the other clients know about them. 

     

    So you can return the ID into a variable or something. with onclick you can do Set(varInsertedID, Patch(logic).ID), then use that varInsertedID to generate the ID and update using the above logic. So generate the base record, return ID, generate ID from math on that ID then Patch again to update with the new ID etc. and continue.   

     

  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    Hi @Anonymous ,

    You cannot avoid concurrent duplication on sequential numbers if the second user queries the data before their list is refreshed following the updating by the first user. You could put Refresh(SW_Details_Test) before the patch but this will not completely eliminate the possibility of it happening.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

     

  • Community Power Platform Member Profile Picture
    on at

    Thanks Warren, what I am trying to do is dynamically duplicating records with new application ID, so in other words whatever user type the value it creates duplicate records with new application ID. 

     

    asif082_0-1642499570540.png

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    Thanks cwebb365. The problem is auto generated SQL ID is not helpful in current situation. As per business requirement I need to use custom application number  e.g. SW-00001, SW-00002, SW-00003 etc and there are multiple locations using this application. So, one of the requirement is asking user to duplicate record dynamically by entering value. so if user enter 8 as a value and click yes then using last store application number it add plus 1 and so on 8 time according to below.

     

    asif082_1-1642501745958.png

     

    I am still confused how I achieve above. Any help would be really helpful.

     

    Thanks

     

  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    Hi @Anonymous ,

    I am not sure how to respond further - concurrent use of this (although the window should only be seconds) will create duplicates.

  • Community Power Platform Member Profile Picture
    on at

    So, any solution or possible work around to avoid duplicates? I have tried first patching without Application number and storing records into collection and then patching that collection and then assigning Application number to unique id but still no luck.

  • Verified answer
    WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    Hi @Anonymous ,

    You need some reference number, whether it be CountRows or a stored number that each user will see when they open the record. The process then actions according to the information they have at that time. As I mentioned, you could refresh or requery to shorten the "window", but ultimately two users within a few seconds of each other will action the same information.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    Again, you have to rely on generated id from the backend. You return that THEN generate your custom number. So when you generate your ID, you plug the ID in and add or subtract that value to meet you're needs, but it has to base off that number to keep uniqueness, no other way. Or you can use a Table to do the same thing as well where you "Generate" a code and return it as well. But either way, you cannot use your app to generate the ID you have to have a transaction take place in a central location. 

  • Community Power Platform Member Profile Picture
    on at

    Thanks you guys, really appreciate your help 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard