• Nadoora
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi all,
 
I am trying to implment the "convertLead" function provided in the Apex manual.
 
I am getting the following error always :-
 
"The name 'binding' does not exist in the current context".
 
Can anyone help please? also can anyone tell me if there is any other way to perform batch lead conversion?
 
 
This is the function:-
 

static bool convertLead(string leadId, string contactId,

string accountId, bool overWriteLeadSource,

bool doNotCreateOpportunity, string opportunityName,

string convertedStatus, bool sendEmailToOwner)

{

SforceService.LeadConvert leadConvert = new SforceService.LeadConvert();

leadConvert.leadId = leadId;

leadConvert.contactId = contactId;

leadConvert.accountId = accountId;

leadConvert.overwriteLeadSource = overWriteLeadSource;

leadConvert.doNotCreateOpportunity = doNotCreateOpportunity;

leadConvert.opportunityName = opportunityName;

leadConvert.convertedStatus = convertedStatus;

leadConvert.sendNotificationEmail = sendEmailToOwner;

SforceService.LeadConvertResult[] lcr = null;

try

{

lcr = binding.convertLead(new SforceService.LeadConvert[] { leadConvert });

for (int i = 0; i < lcr.Length; i++)

if (lcr[i].success)

{

Console.WriteLine("Conversion succeeded.\n");

SforceService.LeadConvertResult result = lcr[i];

Console.WriteLine("The new contact id is: " + result.contactId);

}

else

{

Console.WriteLine("The conversion failed because: " + lcr[i].errors[0].message);

}

}

catch (Exception e)

{

Console.WriteLine("Unexpected error encountered:\n\n" + e.Message);

return false;

}

return true;

}