Answered by:
What is the easiest way to create an Auto number?

Question
-
We need to create an autonumber, like a reference and store in a field called "Reference ID". What is the fastest and easiest way to create an autonumber?
Thanks
Monday, November 24, 2014 4:55 PM
Answers
-
If it's a quick solution, I've used this system in the past:
function setReferenc() {
var code = "ACN";
var lastName = Xrm.Page.getAttribute("new_lastname").getValue();
var rnd = Math.floor((Math.random() * 99999) + 1000);
var refNo = code + "\" + rnd + "-" + lastName;
}Not completely guaranteed to be unique, but it works.
- Marked as answer by RaKutt Monday, November 24, 2014 5:26 PM
Monday, November 24, 2014 5:24 PM
All replies
-
use this solution:
https://advcrm2011autonumber.codeplex.com/
My blog: www.crmanswers.net - Rockstar 365 Profile
- Proposed as answer by Guido PreiteMVP Monday, November 24, 2014 5:09 PM
Monday, November 24, 2014 5:09 PM -
If it's a quick solution, I've used this system in the past:
function setReferenc() {
var code = "ACN";
var lastName = Xrm.Page.getAttribute("new_lastname").getValue();
var rnd = Math.floor((Math.random() * 99999) + 1000);
var refNo = code + "\" + rnd + "-" + lastName;
}Not completely guaranteed to be unique, but it works.
- Marked as answer by RaKutt Monday, November 24, 2014 5:26 PM
Monday, November 24, 2014 5:24 PM -
Sorry, I had this one before but the developer doesn't share his code so I don't want to install that one.Monday, November 24, 2014 5:26 PM
-
Thanks, this will work.Monday, November 24, 2014 5:27 PM