You need to sign in to do that
Don't have an account?

Submitting a lead to Salesforce
Hi,
I am trying to submit a lead to salesforce with asp.net in c# and am not having any luck. The code below executes fine but nothing is getting submitted to my salesforce development site. What login and pwd am I suppose to be using and what access rights should the login have? Am I missing something? When I execute the code below it does not return an id with saveResults.
private void createLead() {
//Create the proxy binding and login
sforce.SforceService binding = new sforce.SforceService();
sforce.LoginResult lr = binding.login("login", "pwd");
binding.SessionHeaderValue = new sforce.SessionHeader();
binding.SessionHeaderValue.sessionId = lr.sessionId;
binding.Url = lr.serverUrl;
// Create an account object to send to the service
Credco.Web.SignUp.sforce.Lead sfLead = new Credco.Web.SignUp.sforce.Lead();
// Set several properties
sfLead.FirstName = "Test";
sfLead.LastName = "Tester";
sfLead.LeadSource = "Testing";
// Add the account to an array of SObjects
sforce.sObject[] records = new sforce.sObject[] {sfLead};
// Invoke the create call, passing in the account properties
// and saving the results in a SaveResult object
sforce.SaveResult[] saveResults = binding.create(records);
// Access the new ID
String newID = saveResults[0].id;
}
sforce.SaveResult [] sr = binding.create(records);
for ( int i = 0 ; i < sr.Length; i++)
{
if (sr[i].success)
Console.WriteLine("{0} Id of new account is {1}", i, sr[i].id);
else
Console.WriteLine("{0} Error creating account : {1}", i,sr[i].errors[0].message);
ids[i] = sr[i].id;
}
That worked. Company was a required field that I was not passing in. Thanks for all of your help Simon.