+ Start a Discussion
dkorba2k5dkorba2k5 

Performance Issues

Had the following functions in Apex added to our Leads page layout that worked great prior to the Summer '09 upgrade.  Now the performance on these is incredibly slow.  Any ideas?

 

 

public Lead[] getRelatedLeads() {return this.relatedleads;}

public void loadRelatedLeads() { String querystring; querystring = 'SELECT id,Website,Title,State,Country,CreatedDate,CreatedById,'; querystring += 'Status,Sales_Region__c,Sales_Area__c,Phone,OwnerId,Owner.Name,Name,'; querystring += 'LastModifiedDate,LastModifiedById,LastActivityDate,IsUnreadByOwner,'; querystring += 'Email,Company,Campaign_Source__c '; querystring += 'FROM Lead WHERE id != \''+pageid+'\' AND IsConverted = FALSE AND (Company LIKE \''+String.escapeSingleQuotes(entry.company)+'\' OR SLXSpam__Scoring_Email_Domain__c =\'' + entry.SLXSpam__Scoring_Email_Domain__c + '\') '; querystring += 'ORDER BY CreatedDate DESC LIMIT 10'; relatedleads = Database.query(querystring); } public Contact[] getConvertedLeads() {return this.convertedleads;} public void loadConvertedLeads() { String querystring; querystring = 'SELECT id,Title,CreatedDate,CreatedById,'; querystring += 'Phone,OwnerId,Owner.Name,Name,'; querystring += 'LastModifiedDate,LastModifiedById,LastActivityDate,'; querystring += 'Email,Account.Name,accountid '; querystring += 'FROM Contact WHERE id != \''+pageid+'\' AND Account.Name LIKE \'%'+String.escapeSingleQuotes(entry.company)+'%\''; querystring += 'ORDER BY CreatedDate DESC LIMIT 10'; convertedleads = Database.query(querystring); }