7

I'm struggling for awhile, must be something very simple...

I'm using metadata api deploy to create a new custom object without success and no errors returned.

My guess would be something with zip package, can someone point me what i'm doing wrong ?

Zip file package contains the following files/folders:

  • unpackaged\package.xml
  • unpackaged\objects\DummyObject__c.object

package.xml content:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>DummyObject__c</members>
        <name>CustomObject</name>
    </types>
    <version>28.0</version>
</Package>

DummyObject__c.object content:

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <actionOverrides>
        <actionName>Accept</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>CancelEdit</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Clone</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Delete</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Edit</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Follow</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>List</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>New</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>SaveEdit</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Tab</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>View</actionName>
        <type>Default</type>
    </actionOverrides>
    <compactLayoutAssignment>SYSTEM</compactLayoutAssignment>
    <deploymentStatus>Deployed</deploymentStatus>
    <enableActivities>false</enableActivities>
    <enableFeeds>false</enableFeeds>
    <enableHistory>false</enableHistory>
    <enableReports>false</enableReports>
    <fields>
        <fullName>UID__c</fullName>
        <caseSensitive>false</caseSensitive>
        <externalId>true</externalId>
        <label>UID</label>
        <length>38</length>
        <required>true</required>
        <trackTrending>false</trackTrending>
        <type>Text</type>
        <unique>true</unique>
    </fields>
    <label>Dummy Object 1</label>
    <nameField>
        <label>Dummy Object Name</label>
        <type>Text</type>
    </nameField>
    <pluralLabel>Dummy Objects</pluralLabel>
    <searchLayouts/>
    <sharingModel>ReadWrite</sharingModel>
</CustomObject>

These are the webservices messages exchanged:

deploy

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <SessionHeader xmlns="http://soap.sforce.com/2006/04/metadata">
      <sessionId>*** sessionId ***</sessionId>
    </SessionHeader>
  </soap:Header>
  <soap:Body>
    <deploy xmlns="http://soap.sforce.com/2006/04/metadata">
      <ZipFile>*** ZipContent ***</ZipFile>
      <DeployOptions>
        <allowMissingFiles>false</allowMissingFiles>
        <autoUpdatePackage>false</autoUpdatePackage>
        <checkOnly>false</checkOnly>
        <ignoreWarnings>false</ignoreWarnings>
        <performRetrieve>false</performRetrieve>
        <purgeOnDelete>false</purgeOnDelete>
        <rollbackOnError>true</rollbackOnError>
        <runAllTests>false</runAllTests>
        <singlePackage>true</singlePackage>
      </DeployOptions>
    </deploy>
  </soap:Body>
</soap:Envelope>

deployResponse

<?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>
    <deployResponse>
      <result>
        <done>false</done>
        <id>09SO0000000ew0sMAA</id>
        <state>Queued</state>
      </result>
    </deployResponse>
  </soapenv:Body>
</soapenv:Envelope>

checkStatus

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <SessionHeader xmlns="http://soap.sforce.com/2006/04/metadata">
      <sessionId>*** sessionId ***</sessionId>
    </SessionHeader>
  </soap:Header>
  <soap:Body>
    <checkStatus xmlns="http://soap.sforce.com/2006/04/metadata">
      <asyncProcessId>09SO0000000ew0sMAA</asyncProcessId>
    </checkStatus>
  </soap:Body>
</soap:Envelope>

checkStatusResponse

<?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>
    <checkStatusResponse>
      <result>
        <done>true</done>
        <id>09SO0000000ew0YMAQ</id>
        <numberComponentErrors>0</numberComponentErrors>
        <numberComponentsDeployed>0</numberComponentsDeployed>
        <numberComponentsTotal>0</numberComponentsTotal>
        <numberTestErrors>0</numberTestErrors>
        <numberTestsCompleted>0</numberTestsCompleted>
        <numberTestsTotal>0</numberTestsTotal>
        <state>Completed</state>
        <stateDetailLastModifiedDate>2013-12-17T21:23:20.000Z</stateDetailLastModifiedDate>
      </result>
    </checkStatusResponse>
  </soapenv:Body>
</soapenv:Envelope>

No errors, nothing deployed, what i'm doing wrong ?

Workbench

Following Daniel Ballinger suggestion to use the workbench, more info returned:

enter image description here

It seems something is wrong with the package no ? but what ?

  • Why do you think you aren't successful? Have you checked in Setup|Create|Objects to verify it isn't there? Are you deploying/checking the same org? – Mike Chale Dec 17 '13 at 22:16
  • yes is not there the object. – Pedro Pereira Dec 17 '13 at 22:18
  • Go to setup -> Monitor deployments? I'm intrigued by the "Queued" status. If any other developer is for example running some long unit tests in same org - slap him. Same if there's anything ongoing in "inbound change sets"... – eyescream Dec 17 '13 at 22:22
  • Nobody is using the target sandbox. In the monitor deployments all my attempts have the status Failed and no more information. No outbound or inbound change sets defined in the target instance. – Pedro Pereira Dec 17 '13 at 22:28
  • I wonder about <compactLayoutAssignment>SYSTEM</compactLayoutAssignment> try with it removed? More candidates: <allowMissingFiles>true</allowMissingFiles>, <ignoreWarnings>true</ignoreWarnings>? And I know it's configured to not run unit tests but still - run them all? Maybe something is fundamentally off in the org? – eyescream Dec 17 '13 at 22:38
3

Make sure your package.xml and the directories containing the metadata component files are in the root of your zip file. In other words, make sure you zip the contents of your 'unpackaged' directory and not the directory itself. This is most likely the reason it is not able to find the package.xml file. I also typically don't specify the singlePackage option either. The docs are a little vague on this i agree...

Every .zip file contains a project manifest, a file named package.xml, and a set of directories that contain the components. The manifest file defines the components you are trying to retrieve or deploy in the .zip file.

(i often think it would be useful to show a directory structure, so i've just used the feedback feature at the bottom of the documentation topic to say so).

Also the missing call to get additional information you need (and the one Workbench is using) is the checkDeployStatus call (note that from API 29 onwards checkStatus is not required you can use checkDeployStatus directly, see deploy).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.