I need a trigger that looks for a lead with the lead source Price Freeze and automatically converts it to an opportunity.
-
3you might want to check out How to Ask– cropredyCommented Apr 21, 2016 at 14:50
-
2I need a large Dunkin Donuts Coffee with cream and sugar– Chris DuncombeCommented Apr 21, 2016 at 14:52
-
1can i get a unicorn?– Benjamin PirihCommented Apr 21, 2016 at 15:21
-
Ok, can someone tell me where to go to learn how to write a trigger? I thought this would be a good place to start, but I guess not.– Leah GustafsonCommented Apr 21, 2016 at 19:45
Add a comment
|
1 Answer
Use this ...Happy Coding :-
for(Lead myLead: Trigger.new) {
if((myLead.isconverted==false) && (myLead.ProfileStatus__c == 'Paid profile')) {// Put your condition here**
Database.LeadConvert lc = new database.LeadConvert();
lc.setLeadId(myLead.Id);
lc.convertedStatus = 'Qualified';
lc.setDoNotCreateOpportunity(false); //Put this flag to false to create opportunity
Database.LeadConvertResult lcr = Database.convertLead(lc);
}
}