Skip to main content
Participant
June 19, 2018
Question

How do I auto-generate an invoice number based on date/time with two random digits?

  • June 19, 2018
  • 1 reply
  • 806 views

I want to add a javascript that auto-generates an invoice number in the following format: yymmddhhmm-rr where the digits are year year month month day day hour hour minute minute - random digit random digit. Can anybody help me with this? I know how to insert it, I just don't know the actual coding.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 19, 2018

This code will do it:

this.getField("InvoiceNumber").value = util.printd("yymmddHHMM", new Date()) + Math.random().toString().substring(2,4);