+ Start a Discussion
anu123anu123 

after converssion convert button not visible in the detailed page

Hi All,

        i override the convert button on lead object.i want to remove the convert button in detail page after once the lead is converted.(OR) we cant possible to edit the lead record once the lead is converted.Any one can u please give me the solution for this.

 

Public class leadconvert{public leadconvert(ApexPages.StandardController controller){}public pagereference convert(){pagereference p;id lid=apexpages.currentPage().getParameters().get('id');list<CO_1__c> co1list=new list<CO_1__c>();
for(lead l:[select LastName,email,FirstName,Company,Status from lead where RecordTypeid =:'012U00000008oe5' and id=:lid and IsConverted=false]){CO_1__c co1=new CO_1__c();contact__C con=new contact__C();co1.Name=l.lastname;insert co1;con.Last_Name__c=l.lastname;con.First_Name__C=l.FirstName;con.email__c=l.email;con.CO_1__c=co1.id;insert con;p=new pagereference('/a00/o');
}for(lead l:[select LastName,email,FirstName,Company,Status from lead where RecordTypeid =:'012U00000008oeA' and id=:lid]){CO_2__c co2=new CO_2__c();contact__C con=new contact__C();co2.Name=l.lastname;insert co2;con.Last_Name__c=l.lastname;con.First_Name__C=l.FirstName;con.email__c=l.email;con.CO_2__c=co2.id;insert con; p=new pagereference('/a01/o');
}
for(lead l:[select LastName,email,FirstName,Company,Status from lead where RecordTypeid =:'012U00000008oeF' and id=:lid]){CO_3__c co3=new CO_3__c();contact__C con=new contact__C();co3.Name=l.lastname;insert co3;con.Last_Name__c=l.lastname;con.First_Name__C=l.FirstName;con.email__c=l.email;con.CO_3__c=co3.id;insert con; p=new pagereference('a02/o');
}
return p;
}}

 

Thanks in advacne.

anu 

MandyKoolMandyKool

Hi,

 

Could you please elaborate what exactly you want to achieve??

 

Its very hard to understand what you have written :)