Skip to main content

Notifications

Community site session details

Community site session details

Session Id : HrQzChDbcNECncWsk3V1iL
Power Apps - Building Power Apps
Answered

Generating random serial number when sending form

Like (0) ShareShare
ReportReport
Posted on 12 Jul 2020 16:29:44 by 27

Thank you

Categories:
  • imrineeman Profile Picture
    27 on 12 Jul 2020 at 19:32:53
    Re: Generating random serial number when sending form

    Works as a charm!

     

    I thank you very much for your patience and help. 🙂

  • mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on 12 Jul 2020 at 18:52:07
    Re: Generating random serial number when sending form

    @imrineeman 
    You need to retype the quotation marks.  Delete them and then retype.  Its because you cut + paste my code directly from this forum and I type it on my mobile.


    (Its a silly quirk of our forums).

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • imrineeman Profile Picture
    27 on 12 Jul 2020 at 18:43:53
    Re: Generating random serial number when sending form

    Yes to sharepoint as db.

    Capture.JPG

     

    Hope this is enough

     

    Thanks again!

  • mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on 12 Jul 2020 at 16:59:31
    Re: Generating random serial number when sending form

    @imrineeman

    Are you using SharePoint as a datasource?  Can I please see a screenshot of the formula showi the error?

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • imrineeman Profile Picture
    27 on 12 Jul 2020 at 16:53:23
    Re: Generating random serial number when sending form

    Thanks for your help.

    Still same issue , on this function : Text(varPatchRecord.ID,“00000”)

  • Verified answer
    mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on 12 Jul 2020 at 16:46:36
    Re: Generating random serial number when sending form

    @imrineeman 

    Try this:

     

    Set(varPatchRecord, LookUp(your_datasource_name, ID=Form1.LastSubmit.ID));

    Patch(your_datasource_name, varPatchRecord, {SerialNumber: Text(varPatchRecord.ID, “00000”)})

     

    I changed the code and missed some brackets earlier.

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • imrineeman Profile Picture
    27 on 12 Jul 2020 at 16:45:34
    Re: Generating random serial number when sending form

    Fixed it, but it says that ID identifier isn't recognized..

  • imrineeman Profile Picture
    27 on 12 Jul 2020 at 16:43:47
    Re: Generating random serial number when sending form

    I'm getting an error on this stage: Text(ID,“00000”) (expected operator, the function text has invalid arguments)

     

    Thanks for helping

  • mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on 12 Jul 2020 at 16:36:23
    Re: Generating random serial number when sending form

    @imrineeman 

    Actually, you don’t need the number to be random.  It creates the problem of having to check for duplicates.  Make a 5 digit number based off of the Item ID instead.


    To do this, put my code in the OnSuccess property of your form.  It will insert the serial number for the Item after the ID is known.

     

    Patch(your_datasource_name, LookUp(your_datasource_name, ID=Form1.LastSubmit.ID), {SerialNumber: Text(ID, “00000”})

     

    Make sure serial number is a text type column so the leading zeros show

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 223 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 110

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 89 Super User 2025 Season 1

Overall leaderboard
Loading started