cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jayant_ab
Frequent Visitor

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);

 

0 REPLIES 0

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.

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.

Users online (2,627)