+ Start a Discussion
Surender reddy SalukutiSurender reddy Salukuti 

is there any way to restrict contact conversion while converting lead record ?

Hi all 

i have one requirement i am converting lead to account using custom logic preventing  Opportunity creation i need to prevent contact convertion also by suing any logic any one have any idea
please find below code which i am using 

    public static id convertlead (Id recordId){
        id accountid;
        lead le = new lead();
        le.RecordTypeId = Schema.SObjectType.Lead.getRecordTypeInfosByDeveloperName().get('Business_Insurance').getRecordTypeId();
         system.debug('recordtypeid--> '+le.RecordTypeId);
        Database.LeadConvert lc = new Database.LeadConvert();
         system.debug('lc value --> '+lc);
        LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
        Database.LeadConvertResult lcr = Database.convertLead(lc);
        accountid =lcr.getAccountId();   
        return accountid;



surender Reddy