• Paladyr
  • NEWBIE
  • 5 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies

I'm getting the error:

 

Error: package.xml(purchase__c): An object 'purchase__c' of type CustomObject was named in package.xml, but was not found in zipped directory.  In the deployTest directory, I have the package.xml file below and an objects folder.  Inside the objects folder, I have a file Purchase__c.object which was retrieved from the org I'm copying metadata from.  What am I missing?  Also, do I have to name all the custom fields?  I thought I could just deploy the custom object but when I tried that it gave me errors saying that the package.xml file didn't contain all the custom fields.  Thanks.

 

package.xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>purchase__c</members>
        <name>CustomObject</name>
    </types>
  <types>
    <members>Purchase__c.Admin_Fee__c</members>
    <members>Purchase__c.Affiliated__c</members>
    <members>Purchase__c.Amount__c</members>
    <members>Purchase__c.Comments__c</members>
    <members>Purchase__c.Fee__c</members>
    <members>Purchase__c.Fiscal_Year__c</members>
    <members>Purchase__c.Member__c</members>
    <members>Purchase__c.Other_Fee__c</members>
    <members>Purchase__c.PurchaseID__c</members>
    <members>Purchase__c.Report_Date__c</members>
    <members>Purchase__c.Report_Total__c</members>
    <members>Purchase__c.Type__c</members>
    <members>Purchase__c.VendorType__c</members>
    <members>Purchase__c.Vendor__c</members>
    <members>Purchase__c.Write_Off__c</members>
    <name>CustomField</name>
  </types>
    <version>22.0</version>
</Package>

 build.xml:

 

<project name="Sample usage of Salesforce Ant tasks" default="purchase" basedir="." xmlns:sf="antlib:com.salesforce">

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

  <target name="purchase">
    <!-- Upload the contents of the "mypkg" package -->
    <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="deployTest"/>
  </target>
</project>

 

 

I'm getting an error, object reference not set to an instance of an object when I reference the sforce contact object and the Account object inside the contact is not set to anything. So basically the contact info is filled into the object, but there is no account object attached to it. I've tried: If not sfContact.Account is nothing If not sfContact.Account.custom_field__c is nothing Neither catches when the Account object is set to nothing. How do I prevent code from being run when the Account object on a contact has not been filled in? I know I could change my query to prevent it from downloading a contact not linked to an account but I would like to know how to do this for future reference. Thanks!

I'm getting the error:

 

Error: package.xml(purchase__c): An object 'purchase__c' of type CustomObject was named in package.xml, but was not found in zipped directory.  In the deployTest directory, I have the package.xml file below and an objects folder.  Inside the objects folder, I have a file Purchase__c.object which was retrieved from the org I'm copying metadata from.  What am I missing?  Also, do I have to name all the custom fields?  I thought I could just deploy the custom object but when I tried that it gave me errors saying that the package.xml file didn't contain all the custom fields.  Thanks.

 

package.xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>purchase__c</members>
        <name>CustomObject</name>
    </types>
  <types>
    <members>Purchase__c.Admin_Fee__c</members>
    <members>Purchase__c.Affiliated__c</members>
    <members>Purchase__c.Amount__c</members>
    <members>Purchase__c.Comments__c</members>
    <members>Purchase__c.Fee__c</members>
    <members>Purchase__c.Fiscal_Year__c</members>
    <members>Purchase__c.Member__c</members>
    <members>Purchase__c.Other_Fee__c</members>
    <members>Purchase__c.PurchaseID__c</members>
    <members>Purchase__c.Report_Date__c</members>
    <members>Purchase__c.Report_Total__c</members>
    <members>Purchase__c.Type__c</members>
    <members>Purchase__c.VendorType__c</members>
    <members>Purchase__c.Vendor__c</members>
    <members>Purchase__c.Write_Off__c</members>
    <name>CustomField</name>
  </types>
    <version>22.0</version>
</Package>

 build.xml:

 

<project name="Sample usage of Salesforce Ant tasks" default="purchase" basedir="." xmlns:sf="antlib:com.salesforce">

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

  <target name="purchase">
    <!-- Upload the contents of the "mypkg" package -->
    <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="deployTest"/>
  </target>
</project>

 

 

I'm getting an error, object reference not set to an instance of an object when I reference the sforce contact object and the Account object inside the contact is not set to anything. So basically the contact info is filled into the object, but there is no account object attached to it. I've tried: If not sfContact.Account is nothing If not sfContact.Account.custom_field__c is nothing Neither catches when the Account object is set to nothing. How do I prevent code from being run when the Account object on a contact has not been filled in? I know I could change my query to prevent it from downloading a contact not linked to an account but I would like to know how to do this for future reference. Thanks!

I am getting started on experimenting with SalesForce.com integration, and imported the Partner WSDL to start playing with it.  When I add a Service reference to the partner.wsdl (Partner Web Services API Version 20.0) I get a dll that contains a class SoapClient but the API docs suggest I should have a SForceService class.  

 

The SoapClient does seem to have the methods necessary to interact with SalesForce.com, but the methods don't match the methods listed in the API.  For example SoapClient has the following method:

 

 

public DescribeGlobalResult describeGlobal(SessionHeader, CallOptions, PackageVersion[])

 

 

whereas the API seems to say the method should be

 

DescrineGlobalResult describeGlobal();

 

I can't help but think I imported this wrong somehow and am going down the wrong path.  Can anyone suggest where I may have gone wrong?

  • January 14, 2011
  • Like
  • 0
The code below runs fine and prints the ID of the newly created object, but when I look in the app, AnnualRevenue is blank!

sforce.Account newAcc = new sforce.Account();
newAcc.Name = "Test Account";
newAcc.AnnualRevenue = 10000;
sforce.SaveResult [] sr = svc.create ( new sforce.sObject[] { newAcc } );
if(sr[0].success)
{
Console.WriteLine("new id of account is {0}", sr[0].id); } else {
Console.WriteLine("error creating account {0}", sr[0].errors[0].message);
}


What's happening is that for field type's that do not support being null in .NET, the generated .NET code includes an additional property that indicates if it should send the value. Unfortuanly even if you explicitly set a value, the property that says to send the value doesn't get set. You need to also set that property as well. These properties have "Specified" appended to the property name they apply to, so the above example should be

sforce.Account newAcc = new sforce.Account();
newAcc.Name = "Test Account";
newAcc.AnnualRevenue = 10000;
newAcc.AnnualRevenueSpecified = true;
sforce.SaveResult [] sr = svc.create ( new sforce.sObject[] { newAcc } );
if(sr[0].success)
{
Console.WriteLine("new id of account is {0}", sr[0].id); } else {
Console.WriteLine("error creating account {0}", sr[0].errors[0].message); }
}

If you run this revised version, you'll see the AnnualRevenue value in the application. Properties of type DateTime, bool, int and double all have these additional specified flags.