You need to sign in to do that
Don't have an account?
Need help for the following
Error: Onaccount111 Compile Error: Incompatible types since an instance of SObject is never an instance of Account at line 30 column 13
VF Page :
<apex:page standardController="Account" extensions="Onaccount111" sidebar="true" id="D001">
<apex:sectionHeader title="Account" id="S001"/>
<apex:form >
<apex:pageBlock id="pb001">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Open"/>
<apex:commandButton value="Delete"/>
</apex:pageBlockButtons>
<apex:pageBlockSection id="pbs" columns="1" title="Search Leads">
<apex:inputField id="f0" label="Parent ParentAccount" value="{!Account.Parentid}"/>
<apex:inputField id="f1" label="Filter by Accountname" value="{!Account.Name}" required="false"/>
<apex:inputField id="f2" label="Filter by Type" value="{!Account.Type}"/>
<apex:inputField id="f4" value="{!Account.Active__c}" label="Active"/>
<apex:inputfield id="f5" label="Priority" value="{!Account.CustomerPriority__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
CLASS :
public class Onaccount111
{
public list<account> acclist{get;set;}
public Account acc{get;set;}
public string Accountname{get;set;}
public boolean pageblk{get;set;}
//public string parentaccount{get;set}
public string type{get;set;}
public string active{get;set;}
// public integer start{get;set;}
public boolean previous{get;set;}
public boolean next{get;set;}
public boolean first{get;set;}
public boolean last{get;set;}
public string query{get;set;}
public string priority{get;set;}
public string accstatus{get;set;}
public string dispstatus{get;set;}
public string openstatus{get;set;}
public string download;
public string start{get;set;}
public string finalsort = '';
public string ss1 = '';
public string reqstatus;
public map<string,string> fieldmap = new map<string,string>();
public Onaccount111(ApexPages.StandardController controller)
{
acc = new Account();
acc=(Account)controller.getrecord();
acclist= new list<account>();
//start=0;
dispstatus='open';
openstatus='open';
// first='true';
// next='false';
// previous='true';
// last='false';
pageblk =false;
download = ApexPages.currentPage().getParameters().get('download');
fieldmap.put('Name','Name');
fieldmap.put('AccountNumber','AccountNumber');
fieldmap.put('Owner','Owner');
fieldmap.put('Parent','Parent');
fieldmap.put('Active','Active__c');
fieldmap.put('CustomerPriority','CustomerPriority__c');
}
public void display(string status)
{
pageblk=true;
this.parentaccount=acc.Parent;
this.Accountname=acc.Name;
this.type=acc.Type;
this.priority=acc.CustomerPriority__c;
this.active=acc.Active__c;
this.accstatus=status;
this.sortby=acc.Sort_By__c;
list<string> sortby1= new list<string>();
/*** if(sortby != null)
{
sortby1=sortby.split(';');
integer size= sortby1.size();
for(string ss: sortby1)
{
string search = ss;
if(fieldmap.containskey(search) == true)
{
ss1 = fieldmap.get(search);
}
if(Ss != sortby1[size-1])
{
finalsort = finalsort + ss1 + ',';
}
if(Ss == sortby1[size-1])
{
finalsort = finalsort + ss1;
}
}
}***/
if(status == 'allaccounts')
{
//if(sortby1.size() == 0)
query = 'select id,status__c,type__c,name__C,Created_Date__c,Lead_Type__c,Status,Name,LeadAddress__c,Email,Phone,LeadSource,GTM_Appt_Schedule__c,Appt_from__c,Appt_Held__c,qbdialer__LastCallTime__c,pi__score__c,pi__first_activity__c,pi__last_activity__c,Previous_Pardot_Score__c,Pardot_score_change_date__c,qbdialer__Dials__c,Follow_up_Date__c,Trend_of_Pardot_score__c from lead where status=:openstatus';
}
}
public void open()
{
validate();
dispstatus ='Open';
reqstatus='Open';
display(reqstatus);
}
public void validate()
{
if(acc.Ownerid != null)
{
ApexPages.Message msg = new Apexpages.Message(ApexPages.Severity.Warning,'No Record Found' );
ApexPages.addmessage(msg);
}
}
}
I have tried a lot but still cant get this. Can anyone tell why this error is coming?
Thanks in advance :)
VF Page :
<apex:page standardController="Account" extensions="Onaccount111" sidebar="true" id="D001">
<apex:sectionHeader title="Account" id="S001"/>
<apex:form >
<apex:pageBlock id="pb001">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Open"/>
<apex:commandButton value="Delete"/>
</apex:pageBlockButtons>
<apex:pageBlockSection id="pbs" columns="1" title="Search Leads">
<apex:inputField id="f0" label="Parent ParentAccount" value="{!Account.Parentid}"/>
<apex:inputField id="f1" label="Filter by Accountname" value="{!Account.Name}" required="false"/>
<apex:inputField id="f2" label="Filter by Type" value="{!Account.Type}"/>
<apex:inputField id="f4" value="{!Account.Active__c}" label="Active"/>
<apex:inputfield id="f5" label="Priority" value="{!Account.CustomerPriority__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
CLASS :
public class Onaccount111
{
public list<account> acclist{get;set;}
public Account acc{get;set;}
public string Accountname{get;set;}
public boolean pageblk{get;set;}
//public string parentaccount{get;set}
public string type{get;set;}
public string active{get;set;}
// public integer start{get;set;}
public boolean previous{get;set;}
public boolean next{get;set;}
public boolean first{get;set;}
public boolean last{get;set;}
public string query{get;set;}
public string priority{get;set;}
public string accstatus{get;set;}
public string dispstatus{get;set;}
public string openstatus{get;set;}
public string download;
public string start{get;set;}
public string finalsort = '';
public string ss1 = '';
public string reqstatus;
public map<string,string> fieldmap = new map<string,string>();
public Onaccount111(ApexPages.StandardController controller)
{
acc = new Account();
acc=(Account)controller.getrecord();
acclist= new list<account>();
//start=0;
dispstatus='open';
openstatus='open';
// first='true';
// next='false';
// previous='true';
// last='false';
pageblk =false;
download = ApexPages.currentPage().getParameters().get('download');
fieldmap.put('Name','Name');
fieldmap.put('AccountNumber','AccountNumber');
fieldmap.put('Owner','Owner');
fieldmap.put('Parent','Parent');
fieldmap.put('Active','Active__c');
fieldmap.put('CustomerPriority','CustomerPriority__c');
}
public void display(string status)
{
pageblk=true;
this.parentaccount=acc.Parent;
this.Accountname=acc.Name;
this.type=acc.Type;
this.priority=acc.CustomerPriority__c;
this.active=acc.Active__c;
this.accstatus=status;
this.sortby=acc.Sort_By__c;
list<string> sortby1= new list<string>();
/*** if(sortby != null)
{
sortby1=sortby.split(';');
integer size= sortby1.size();
for(string ss: sortby1)
{
string search = ss;
if(fieldmap.containskey(search) == true)
{
ss1 = fieldmap.get(search);
}
if(Ss != sortby1[size-1])
{
finalsort = finalsort + ss1 + ',';
}
if(Ss == sortby1[size-1])
{
finalsort = finalsort + ss1;
}
}
}***/
if(status == 'allaccounts')
{
//if(sortby1.size() == 0)
query = 'select id,status__c,type__c,name__C,Created_Date__c,Lead_Type__c,Status,Name,LeadAddress__c,Email,Phone,LeadSource,GTM_Appt_Schedule__c,Appt_from__c,Appt_Held__c,qbdialer__LastCallTime__c,pi__score__c,pi__first_activity__c,pi__last_activity__c,Previous_Pardot_Score__c,Pardot_score_change_date__c,qbdialer__Dials__c,Follow_up_Date__c,Trend_of_Pardot_score__c from lead where status=:openstatus';
}
}
public void open()
{
validate();
dispstatus ='Open';
reqstatus='Open';
display(reqstatus);
}
public void validate()
{
if(acc.Ownerid != null)
{
ApexPages.Message msg = new Apexpages.Message(ApexPages.Severity.Warning,'No Record Found' );
ApexPages.addmessage(msg);
}
}
}
I have tried a lot but still cant get this. Can anyone tell why this error is coming?
Thanks in advance :)
Do you have an Apex class named 'Account' by any chance ?
If so, that maybe the problem.
Regards,
Lakshmi.
All Answers
Do you have an Apex class named 'Account' by any chance ?
If so, that maybe the problem.
Regards,
Lakshmi.
On line 30, don't you have to write
Hope this helps,
Fred