Hi Can anyone please tell me how to solve this error.
Code:
public class LeadConversion {
public PageReference RedirecttoLead() {
String currentLead = '/' + siteObj.Id;
PageReference pageRef = new PageReference(currentLead);
return pageRef;
}
private Site__c siteObj,temp_siteObj;
public ID Cus_Account_ID;
public ID Cus_obj_Record_ID;
// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public LeadConversion(ApexPages.StandardController stdController)
{
System.debug('******Voltum******');
siteObj = (Site__c)stdController.getRecord();
Cus_obj_Record_ID = siteObj.Id;
}
public void convertLead(){
Account acc = new Account();
acc.Name = siteObj.Name;
acc.CurrencyIsoCode = siteObj.CurrencyIsoCode;
try
{
insert acc;
}
Catch (Exception ex1)
{
ex1.getmessage();
}
Contact cc = new Contact();
cc.LastName = siteObj.LastName__c;
temp_siteObj=[select AccountId from contact where Id ='Cus_obj_Record_ID'];
Cus_Account_ID = temp_siteObj;
cc.AccountId= Cus_Account_ID;
// cc.accountId = siteObj.Name;
//Id accountId = [select AccountId from Contact where Id = {ID}][0].AccountId;
//System.Debug(accountId);
try
{
insert cc;
}
Catch (Exception ex2)
{
ex2.getmessage();
}
}
}
Waiting for the reply.