+ Start a Discussion
dmchengdmcheng 

Using ant to deploy custom objects

Hello.  I have a metadata .object file and I'm trying to use ant to create the custom object in my sandbox.  If I limit the package.xml file to a single field, then it works, but if I try to create all the fields, I get errors "not in package.xml" even though I do have the fields there.

 

I've searched the documentation but there is no good example on how to deploy a complete custom object.  Any ideas as to where I'm going wrong?

 

BTW - this is a Custom Settings object.

 

Here's a portion of my xml file:

 

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>GWpkg</fullName>
    <types>
        <members>OppRollupSettings__c</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>OppRollupSettings__c.Assume_Fiscal_Year_Starts_January__c</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>OppRollupSettings__c.Enable_Opp_Rollup_Triggers__c</members>
        <name>CustomField</name>
    </types>
    <version>20.0</version>
</Package>

 

 

 

Here's my build.properties file:

 

"antlib:com.salesforce">

    <property file="build.properties"/>
    <property environment="env"/>

    <!-- Test out deploy and retrieve verbs for package 'GWpkg' -->
    <target name="deploy">
      <!-- Upload the contents of the "GWpkg" package -->
      <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="GWpkg"/>
    </target>
</project>

 

 

 

 

Cory CowgillCory Cowgill

Take a look at the Developer Guide ANT Example. http://wiki.developerforce.com/index.php/Developer_Guide_Intro

 

There are some packages there which upload Custom Objects. Here is the direct link to the source:

 

http://www.apexdevnet.com/media/ForcedotcomBookLibrary/DevGuide20081003.zip

Cory CowgillCory Cowgill

You mention this is a Custom Setting also. Have you tried a regular Custom Object? Custom Settings are a little bit finicky, you can't create them in the IDE for example.

Jaap ScheperJaap Scheper
Merge the fields in one root <types> attribute
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="<a href="http://soap.sforce.com/2006/04/metadata" target="_blank" rel="nofollow">http://soap.sforce.com/2006/04/metadata</a>">
    <fullName>GWpkg</fullName>
    <types>
        <members>OppRollupSettings__c</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>OppRollupSettings__c.Enable_Opp_Rollup_Triggers__c</members>
        <members>OppRollupSettings__c.Assume_Fiscal_Year_Starts_January__c</members>
        <name>CustomField</name>
    </types>
    <version>20.0</version>
</Package>