public class LeadClass{
private Lead leadToConvert = null;
public LeadClass(){
//Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons');
//insert myLead;
String leadId = System.currentPageReference().getParameters().get('leadId');
leadToConvert = [SELECT Id,Phone, Company
FROM Lead WHERE Id = :leadId];
Database.LeadConvert lc = new database.LeadConvert();
lc.setLeadId(leadToConvert.id);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
System.assert(lcr.isSuccess());
}
}
==============
<apex:page controller="LeadClass">
</apex:page>
======================
https://developer.salesforce.com/forums/?id=906F0000000MIzZIAW__Trigger and test
https://developer.salesforce.com/forums/?id=906F00000008zJVIAY---trigger and test2
http://stackoverflow.com/questions/30092286/lead-conversion-in-salesforce-using-apex
https://developer.salesforce.com/forums/?id=906F0000000AdlYIAS---good example
https://developer.salesforce.com/forums/?id=906F00000008xTWIAY-----with simple example
http://salesforce.stackexchange.com/questions/4756/convert-lead-through-apex-but-should-not-create-opportunity
====
==https://developer.salesforce.com/forums/?id=906F00000008xTWIAY
apex/LeadConversion?leadId={!Lead.Id}'
https://c.ap2.visual.force.com/apex/ld?leadId='00Q2800000LVmZh'
private Lead leadToConvert = null;
public LeadClass(){
//Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons');
//insert myLead;
String leadId = System.currentPageReference().getParameters().get('leadId');
leadToConvert = [SELECT Id,Phone, Company
FROM Lead WHERE Id = :leadId];
Database.LeadConvert lc = new database.LeadConvert();
lc.setLeadId(leadToConvert.id);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
System.assert(lcr.isSuccess());
}
}
==============
<apex:page controller="LeadClass">
</apex:page>
======================
https://developer.salesforce.com/forums/?id=906F0000000MIzZIAW__Trigger and test
https://developer.salesforce.com/forums/?id=906F00000008zJVIAY---trigger and test2
http://stackoverflow.com/questions/30092286/lead-conversion-in-salesforce-using-apex
https://developer.salesforce.com/forums/?id=906F0000000AdlYIAS---good example
https://developer.salesforce.com/forums/?id=906F00000008xTWIAY-----with simple example
http://salesforce.stackexchange.com/questions/4756/convert-lead-through-apex-but-should-not-create-opportunity
====
==https://developer.salesforce.com/forums/?id=906F00000008xTWIAY
apex/LeadConversion?leadId={!Lead.Id}'
https://c.ap2.visual.force.com/apex/ld?leadId='00Q2800000LVmZh'
No comments:
Post a Comment