• JAre
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hello everyone,
 
I am new to SalesForce.com. I am working on a simple application that writes a record. I copy the code from the example given on salesforce.com web site. I have try everything it seems with no positive results. My code is as follow;
 

try

{

SalesForce.sObject account;

sObject[] accs = new sObject[2];

for (int j = 0; j < accs.Length; j++)

{

account = new SalesForce.sObject();

System.Xml.XmlElement[] acct = new System.Xml.XmlElement[14];

int index = 0;

if (accounts == null)

acct[index++] = GetNewXmlElement("AccountNumber", "0000000");

else

acct[index++] = GetNewXmlElement("AccountNumber", "000000" + (accounts.Length + 1));

acct[index++] = GetNewXmlElement("BillingCity", "Wichita");

 // more GetNewXmlElement("xx") here

account.Any = acct;

accs[j] = account;

}

 SaveResult[] sr = binding.create(accs);

When I test my simple method at this point I get error; Object reference not set to an instance of an object.

The error is coming from the line in red.

What is it that is wrong with this code and why do I get this error?

Please help...

 

 

Message Edited by JAre on 12-01-2006 06:56 AM

Message Edited by JAre on 12-01-2006 06:57 AM

  • December 01, 2006
  • Like
  • 0
Hello everyone,
 
I am new to SalesForce.com. I am working on a simple application that writes a record. I copy the code from the example given on salesforce.com web site. I have try everything it seems with no positive results. My code is as follow;
 

try

{

SalesForce.sObject account;

sObject[] accs = new sObject[2];

for (int j = 0; j < accs.Length; j++)

{

account = new SalesForce.sObject();

System.Xml.XmlElement[] acct = new System.Xml.XmlElement[14];

int index = 0;

if (accounts == null)

acct[index++] = GetNewXmlElement("AccountNumber", "0000000");

else

acct[index++] = GetNewXmlElement("AccountNumber", "000000" + (accounts.Length + 1));

acct[index++] = GetNewXmlElement("BillingCity", "Wichita");

 // more GetNewXmlElement("xx") here

account.Any = acct;

accs[j] = account;

}

 SaveResult[] sr = binding.create(accs);

When I test my simple method at this point I get error; Object reference not set to an instance of an object.

The error is coming from the line in red.

What is it that is wrong with this code and why do I get this error?

Please help...

 

 

Message Edited by JAre on 12-01-2006 06:56 AM

Message Edited by JAre on 12-01-2006 06:57 AM

  • December 01, 2006
  • Like
  • 0