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

Unique Request ID Generation

Dear All,

i am trying to generate a unique id based upon year and month criteria. if last request id month and year is equal to current month and year then add +1 into last unique id or else generate the unique id from 001. i have written the code and it is generating ids fine. The issue is if 3 users at the same time click on the button to generate id, it generates one id but duplicates other records id. Thus, the result should be 3 unique id but i get 2 unique and one duplicate as per the 2nd unique id. How can I resolve this issue. I have the code below. Please help

Refresh('Test Request');
With({lastId :Text(Value(Right(First(Sort('Test Request',ID,Descending)).ReqId,2))+1,"000"),

        lastMonth: First(Sort('Test Request',ID,Descending)).ReqId},
        If(Left(lastMonth,5) = Text(Now(),"yy-mm"),
        Set(lasitdvalue,lastId);
        Set(lastmonthvalue,lastMonth);
Set(varReqId, Text(Now(),"yy-mm-") & lastId),
Set(lastmonthvalue,lastMonth);
Set(lasitdvalue,lastId);
Set(varReqId, Text(Now(),"yy-mm-") & "001" )
));
SubmitForm(Form1);ResetForm(Form1);

 

1 REPLY 1
DDM
Helper I
Helper I

Hi @jayant_ab  How did you solve this ?

 

I have a similar issue.

 

Thx 

DDM

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (2,286)