Metadata Create SObject With Auto-Number
Sample SOAP Request Message - Creating an SObject with Auto-Number
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<ns1:SessionHeader soapenv:mustUnderstand="0" xmlns:ns1="http://soap.sforce.com/2006/04/metadata">
<ns1:sessionId>3e8700Dx00000007S6Q!8dgyjntyVDawsOhg.bJSmk10x20ZEqeoOyWLwToLuWPEl8bc1_n4ebHT5l.B38SCfE6g_kux35VdI4_srtghhmCbvI3hzdmXW16eo7BD1wL.W5QyTACW</ns1:sessionId>
</ns1:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<create xmlns="http://soap.sforce.com/2006/04/metadata">
<metadata xsi:type="ns2:CustomObject" xmlns:ns2="http://soap.sforce.com/2006/04/metadata">
<fullName>sample__c</fullName>
<deploymentStatus>Deployed</deploymentStatus>
<description>created by the Metadata API</description>
<enableActivities>true</enableActivities>
<label>sample Object</label>
<nameField>
<displayFormat>AN-{0000}</displayFormat>
<label>sample__c Name</label>
<type>AutoNumber</type>
</nameField>
<pluralLabel>sample Objects</pluralLabel>
<sharingModel>ReadWrite</sharingModel>
</metadata>
</create>
</soapenv:Body>
</soapenv:Envelope>
Sample SOAP Response
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
<soapenv:Body>
<createResponse>
<result>
<done>false</done>
<id>04sx00000000Do4AAE</id>
<secondsToWait>2</secondsToWait>
<state>InProgress</state>
</result>
</createResponse>
</soapenv:Body>
</soapenv:Envelope>