I have created a custom field in custom object, in that i am getting the value and when clicked custom button "convert" which is create a new contact. But when converting i am getting this error.
Error Message: Error: Compile Error: Illegal assignment from String to SOBJECT:Account at line 37 column 9
Code:
public class LeadConversion {
public PageReference RedirecttoLead()
{
String currentLead = '/' + siteObj.Id;
PageReference pageRef = new PageReference(currentLead);
return pageRef;
}
private Site__c siteObj;
// 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('******sai******');
siteObj = (Site__c)stdController.getRecord();
}
public void convertLead(){
Contact cc = new Contact();
cc.LastName = siteObj.LastName__c;
**cc.Account = siteObj.Name;**
try
{
insert cc;
}
Catch (Exception ex2)
{
ex2.getmessage();
}
}
}
Kindly anyone tell how to solve this issue.
cc.Account = siteObj.Name;
is causing the error?