There is a particular scenario where an auto-number field had to be disabled during a certain operation. This example on salesforce is exactly similar to my restore requirement. For this, the field should be converted from auto-number to a text field and then operated. This is done using Metadata API.
However, there seems to be a small issue here. If the field is neither createable nor updateable, the field value cannot be changed. This was double checked with the describesobjectresult calls.
Can this restriction be worked around?
To give an example, a custom object under the name testautonumber__c, the properties of the object are:
FieldName IsCreateable IsUpdateable SoapType FieldType IsAutoNumber
Id FALSE FALSE ID id FALSE
OwnerId TRUE TRUE ID reference FALSE
IsDeleted FALSE FALSE _boolean _boolean FALSE
Name FALSE FALSE string string TRUE
CreatedDate FALSE FALSE dateTime datetime FALSE
CreatedById FALSE FALSE ID reference FALSE
LastModifiedDate FALSE FALSE dateTime datetime FALSE
LastModifiedById FALSE FALSE ID reference FALSE
SystemModstamp FALSE FALSE dateTime datetime FALSE
LastViewedDate FALSE FALSE dateTime datetime FALSE
LastReferencedDate FALSE FALSE dateTime datetime FALSE
text__c TRUE TRUE string textarea FALSE
**auto__c FALSE FALSE string string TRUE**
The field auto__c had to be changed to both updateable and createable. I think this would clear up the whole requirement. Before restoring the object testautonumber__c,
All the autonumber fields had to be converted to the string type and made updateable and createable (?) to accommodate the data
Create/Update the records to the object with the data
Undo the changes in step 1