-2

I need a trigger that looks for a lead with the lead source Price Freeze and automatically converts it to an opportunity.

4
  • 3
    you might want to check out How to Ask
    – cropredy
    Commented Apr 21, 2016 at 14:50
  • 2
    I need a large Dunkin Donuts Coffee with cream and sugar Commented Apr 21, 2016 at 14:52
  • 1
    can i get a unicorn? Commented 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. Commented Apr 21, 2016 at 19:45

1 Answer 1

1

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);
        }
  }

Not the answer you're looking for? Browse other questions tagged .