function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pinoytechiepinoytechie 

why does autonumber starts with zero?

i have may be a hundred objects with autonumber that will be deployed to production.

 

now as i've tested it in our assembly, autonumber will start with zero unless you go those fields one by one and explicitly specify to start it with '1'.

 

considering the number of objects i have, and the awkward way to reset it (change to text, save, change back to autonumber, set starting number), this would be very tedious... and might cause delay to get productive.

 

is there anyway to swiftly done this? why would you have an autonumber in the first place that by default starts with zero?

SfdcStevenSfdcSteven

The default autonumber when using the metadata API or change sets is "1".  I'm not sure how you created them with zero unless they were specifically set with zero.

 

-Steven

pinoytechiepinoytechie

not in winter 14.

 

here's how to reproduce it:

 

1) create a custom object, "Name" being in auto-number in {0000} format, set the starting number 1.

2) create tab for it to test.

3) create new record of c. object created in number step #1

4) see the name field, it is correct.

5) deploy the newly created object to another sandbox via changeset.

6) create new record of it

7) name field value is all zeroes!

Satish_SFDCSatish_SFDC
Hi,
This seems to be an error in Salesforce.

I suggest you create a case in salesforce to check if this is an error.

Hope this helps!
Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.
Satish_SFDCSatish_SFDC
I tested this and was able to reproduce this issue. However, i used the Force.com IDE to deploy it and not the changeset.
It seems that there is an error in the underlying metadata API.

It seems as a workaround, we should comment out the field in the IDE while deploying and then deploy.
Once the deployment is done, we can recreate the same field in the target org.

Please create a case in salesforce, so this can be reported.

Hope this helps!
Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.
Satish_SFDCSatish_SFDC
Or while deploying through the IDE, you can add the following tag in the field.

<startingNumber>1</startingNumber>

and then deploy. I tested this and it is working. For some reason the metadata api is not retrieving the starting number and could not be passed over to the target.
Manually adding the tag works though.

Hope this helps!
Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.