1

I did an export of metadata my Account object. I uploaded the same zip to be deployed using the Metadata API. Got the following error:

Parser was expecting element 'http://soap.sforce.com/2006/04/metadata:createdDate' but found 'http://soap.sforce.com/2006/04/metadata:createdBy'

Any idea why?

1 Answer 1

1

It is probably a versioning issue.

Version 30.0 of the Metadata WSDL includes createdBy and createdByName elements (marked with x ... x below) that were not present in earlier versions and the elements must be in exact sequence:

<xsd:complexType name="DeployResult">
    <xsd:sequence>
        <xsd:element name="canceledBy" minOccurs="0" type="xsd:string"/>
        <xsd:element name="canceledByName" minOccurs="0" type="xsd:string"/>
        <xsd:element name="checkOnly" type="xsd:boolean"/>
        <xsd:element name="completedDate" minOccurs="0" type="xsd:dateTime"/>
      x <xsd:element name="createdBy" type="xsd:string"/> x
      x <xsd:element name="createdByName" type="xsd:string"/> x
        <xsd:element name="createdDate" type="xsd:dateTime"/>
        <xsd:element name="details" type="tns:DeployDetails"/>
        ...

Your error suggests that the code you are running was built using a version of the Metadata API before 30.0 but the org you are connecting to is returning API 30.0 or later data (that contains the unexpected createdBy and createdByName elements). Not sure why the versions are not being automatically matched.

So getting or building an API 30.0 version of whatever tool you are using would be one way to fix this.

You must log in to answer this question.

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