function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PRADEEP YADAV 5PRADEEP YADAV 5 

Lead Converted Automatically

whenever lead get saved with web then automatically convert it
trigger LeadConvert on Lead(after Insert, after Update)
    {
        List<String>LeadName = new List<String>();
        for(Lead myLead : trigger.new)
        {
            if(myLead.isconverted ==false && myLead.LeadSource == 'web')
            {
                Database.LeadConvert lc = new Database.LeadConvert();
                lc.setLeadId(myLead.Id);
                lc.convertedStatus = 'Closing-Converted';
                lc.setDoNotCreateOpportunity(true);
                Database.LeadConvertResult lcr = Database.convertLead(lc);
                System.assert(lcr.isSuccess());
            }   
        }
 }
try but lead not converted then how to converted automatically
Best Answer chosen by PRADEEP YADAV 5
AbhishekAbhishek (Salesforce Developers) 
Hi Pradeep,

Try the code as mentioned in the below blogs,

https://developer.salesforce.com/forums/?id=9060G000000XdnXQAS

https://developer.salesforce.com/forums/?id=906F0000000BYZ2IAO

https://developer.salesforce.com/forums/?id=9060G0000005O8jQAE

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks.

All Answers

AbhishekAbhishek (Salesforce Developers) 
Hi Pradeep,

Try the code as mentioned in the below blogs,

https://developer.salesforce.com/forums/?id=9060G000000XdnXQAS

https://developer.salesforce.com/forums/?id=906F0000000BYZ2IAO

https://developer.salesforce.com/forums/?id=9060G0000005O8jQAE

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks.
This was selected as the best answer
PRADEEP YADAV 5PRADEEP YADAV 5
Thanks Abhishek
PRADEEP YADAV 5PRADEEP YADAV 5
Abhishek One Question To You Iam Final Year Student Build one Project in Salesforce Developer Part.
Please Abhishek Suggesting to me Which Type of Project Build in Developer Part
AbhishekAbhishek (Salesforce Developers) 
Try this,

https://1000projects.org/projects/salesforce-projects

https://www.couponxoo.com/final-year-project-on-salesforce