2

I am attempting to migrate a Custom Object using Salesforce, and all is well except the Starting Number for a formatted AutoNumber field is not pulled.

I have read through the MetaData Guide (below) and cannot find an example of how to implement this into my package.xml file.

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customfield.htm

Regarding the note that startingNumber cannot be retrieved, I have tried to put this into the deploy package.xml file.

Thanks for the help.

1 Answer 1

5

See this note:

  • You can’t retrieve the starting number of an auto-number field through Metadata API. To specify a Starting Number while deploying, add a startingNumber tag for your field to your package.xml file. For example: 42
  • If you deploy without specifying a Starting Number value in your package.xml file, the default starting number for standard fields is 0. The default starting number for custom fields is 1.

Here's a sample where I was able to set it by just manually injecting it into the retrieve metadata:

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
....
<fields>
    <fullName>Starting_Number_test__c</fullName>
    <displayFormat>{0}</displayFormat>
    <externalId>false</externalId>
    <label>Starting Number test</label>
    <trackTrending>false</trackTrending>
    <startingNumber>999</startingNumber>
    <type>AutoNumber</type>
</fields>
....
</CustomObject>

You may need a post retrieval script to accomplish the same if you want to automate this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .