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 / Best practice ticket n...
Power Apps
Unanswered

Best practice ticket number

(0) ShareShare
ReportReport
Posted on by

Dear all,

I have created an app that should create a unique ticket number when a end user submits a ticket. 
My app is running on a SharePoint list, where I have created an column "Ticket number" I imported this field to my Edit form and set the default to sum(Last('Sharepointlist').ID+100001) when the last id is 10 it should give me a ticket number of 1000011 and this workes fine.

The issue is that when 2 or more end users want to submit a ticket on the same time they all will get this ticket number, because the default ticketfield will get filled in on the time the ticket get opened. So I created the next solution:

On the submit button where I Submit the form I have entered the following code:
Set(ticketnumber,true);
SubmitForm(Form).

On the DataCardValue from the ticket number I have created the following code:
If(
   Ticketnumber = true,

    sum(Last('Sharepointlist').ID+100001)
)

With this solution I thought I could avoid duplicate ticket numbers, but somehow it still isn't working, I still get duplicates.
Is there any best practice for unique ticket numbers?

Thanks!

Ramon

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    Please try this formula:

    SubmitForm(Form1);Patch(LIST278,LookUp(LIST278,ID=Form1.LastSubmit.ID),{'Ticket number':Form1.LastSubmit.ID+100000})

    Now the datacard of ticket number is no longer needed in form.

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    on at

    Hi @v-xiaochen-msft ,

    Thank you for your reply, my current code with your adjustmnts looks like this:

    CCRNewticket.Run(Last('AR support request').ID+1);
    Patch('AR support request',Defaults('AR support request'),Form1.Updates,Form2.Updates);
    Patch('AR support request',LookUp('AR support request',ID=Form1.LastSubmit.ID),{'Ticket number':Form1.LastSubmit.ID+100000});
    Navigate(Home);
    ResetForm(Form1);
    ResetForm(Form2)

    When I submit the ticket there is no ticket number visable, did I miss something?

    In the first Patch function I am submitting form 1 and 2 as a combined 

  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    Form.LastSubmit.ID is blank because you don't actually use SubmitForm function.

    Please try this:

    CCRNewticket.Run(Last('AR support request').ID+1);
    Set(var,Patch('AR support request',Defaults('AR support request'),Form1.Updates,Form2.Updates));
    Patch('AR support request',var,{'Ticket number':var.ID+100000});
    Navigate(Home);
    ResetForm(Form1);
    ResetForm(Form2)

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    on at

    This is great, thank you so much!

  • knsrinath Profile Picture
    527 on at

    Hi @v-xiaochen-msft 

     

    I have same issue, I am not using form control.

    I am using following code for generating the Ticket No 

     

    In patch 

    SLNo:First(Sort(mySPList, SLNo, SortOrder.Descending)).SLNo+1,
    orderNo:Text(First(Sort(mySPList, SLNo, SortOrder.Descending)).SLNo+1,"00000"),

     

    I am not using default sharepoint ID column.

     

    Request you help me resolve the issue.

     

    Thanks & Regards

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard