+ Start a Discussion
withoutmewithoutme 

Lead auto conversion

I have a requirement where web2leads need to be automatically converted.

 

So

1. I have a before update trigger that takes the lead and assigns lead owners depending on the workload. (Round robin assignment)

2. after update trigger that uses the convertLead() method to convert the lead.

 

The debug log says the conversion result is true (look below) and even gives me the IDs of the account, contact and opportunities. however, these records are NO WHERE to be found. Appending the IDs to the instances like https://na5.salesforce.com/00Q7000000QNZjwEAH only results in 

"

Data Not Available

The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page"

 

0090505071239.525:Class.w2l.convld: line 14, column 42:     DML Operation executed in 2132 ms20090505071239.525:Class.w2l.convld: line 15, column 9: CONVERSION RESULT IS::::Database.LeadConvertResult[getAccountId=0017000000Wl66SAAR;getContactId=0037000000fSu8CAAS;getErrors=();getLeadId=00Q7000000QNZjwEAH;getOpportunityId=0067000000G0rGQAAZ;isSuccess=true;]20090505071239.525:Class.w2l.convld: line 23, column 28: SOQL query with 1 row finished in 5 ms20090505071239.525:Class.w2l.convld: line 24, column 9: CONVERTED OPPORTUNITY ISOpportunity:{RecordTypeId=0127000000016bhAAA, Id=0067000000G0rGQAAZ}20090505071239.525:Trigger.autoconvertW2L: line 6, column 21:     returning from end of method public static void convld(SOBJECT:Lead) in 2146 ms20090505071239.525:Trigger.autoconvertW2L: line 7, column 17: IM BACK FROM CONVERSION20090505071239.525:Trigger.autoconvertW2L: line 11, column 9: CONVERION COMPLETE

 

 Searching in the search bar = no result. Where are my records??? What am I missing?

 

FYI. Creating new leads thru the UI and setting the custom piclist to web2 lead, works flawlessly. Ownerships is update and lead is auto converted on save. Its when the lead comes from web, that this happens. 

Message Edited by withoutme on 05-05-2009 01:09 AM
HarmpieHarmpie
Are you sure you tried to append the account and opportunity Id's to the URL. The example you gave uses the Lead Id (and the lead is gone after conversion)
withoutmewithoutme
Ofcourse I have. I copy-pasted the wrong URL. I have tried all three IDs - Account, Contact and Opportunity
withoutmewithoutme

For those who are interested in this topic, I logged a case with salesforce developer support - which got escalated (with no answers yet).

 

But in the meanwhile, I got a workable solution. The problem was the salesforce was not committing the data. Hence the problem of "Date not available". I tweaked my auto conversion method to execute asynchronously using the @future method and it works great. Until salesforce says there is a better way to do it, I guess I will have to go this route.