Skip to main content
Participant
Jun 19, 2018 8:18 PM UTC
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.

1 reply

try67
Community Expert
Community Expert
Jun 19, 2018 9:12 PM UTC

This code will do it:

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

Translate