You need to sign in to do that
Don't have an account?
AstroCRM
Random number generation?
Hi all,
I have a bit of a problem here, I need a field that generates an random 7 digits number when a record is created. Can anyone think of a way on how to do this?
Any help would be highly appreciated.
I have a bit of a problem here, I need a field that generates an random 7 digits number when a record is created. Can anyone think of a way on how to do this?
Any help would be highly appreciated.
1. Override NEW to call an S-Control that creates the object, generates a random number (with Javascript Math.random() ) into a field, saves the object, and redirects to the Edit page for that object id.
2. If you want it all in the Formula field, you could instead hack together some sort of pseudo random generator. You've got several "random" numbers at your disposal already to use as a key, the ID of the Object being the most obvious one, as well as the time value in the "Creation Date" field. Some sort of weak algorithm like middle squares would probably be sufficient depending on how many records you're creating and what your tolerance for duplicates is.
3. Lastly, and perhaps easiest, the Salesforce ID for the record you've just created may not be random, but it is supposed to be unique. Is uniqueness sufficient to your need? If so, perhaps just use a subset of that ID number.
Best of luck, Steve.