You need to sign in to do that
Don't have an account?
Unabe to capture valid leads
Hi, I am relatively new to sforce, so maybe I am missing something obvious here. I am trying to retrive Lead details(through the lead ID).
Question : How do I check to see if a valid lead corresponding to that ID is returned. Checking for sobjects !=null && sobjects.Length > 0 does not seem to be doing the trick.
The code is as follows....
private sforce.Lead getLead(string LeadID)
{
String[] ids = null;
sforce.Lead lead = null;
try
{
ids = new string[] {LeadID};
sforce.sObject[] sobjects = binding.retrieve("City, Company, Country, Email, FirstName, OwnerId, Phone, Salutation, State, Street, Title, Website","lead",ids);
if (sobjects != null && sobjects.Length > 0)
{
lead = (sforce.Lead)sobjects[0];
CompanyName = lead.Company;
return lead;
}
else
{
// Can I capture the errors returned by sobject collection here???
return null;
}
}
catch(Exception ex)
{
throw new ApplicationException(" Error in retriving Lead information :" + ex.Message );
}
}
Cheers,
Rohit
QueryResult qr = null;
qr = binding.query("select The,Attributes,That,You,Want From Lead where ID ='"+YOURID+"'");
if (qr.size > 0 )
{
Then you have what you want
}
else
{
You dont
}
Good luck
Gareth
if (sobjects[0] != null)
{
// do some stuff
}
Are there any other good practices like that - especially for handling bulk data?
Thanks
Gareth.
and
http://blog.sforce.com/sforce/performance/index.html
G
PS Was trying to rate your replies at 5 = but can't find the rating button. Where did it go?
Cheers,
Rohit