You need to sign in to do that
Don't have an account?
Nitzan Marinov
Adding a standard field to an apex query - error
Hi there,
I'm trying to make a simple change to this Apex code, trying to add RecordType to the list of fields displayed (see in bold):
public class AttendeeController{
// global List<SelectableAccount> accounts {get;private set;}
public List<ClientWrapper> clientList {get;set;}
public Set<Id> selClientIds {get;set;}
public Boolean hasSelClient {get;set;}
public String datename {get; set;}
public AttendeeController()
{
clientList = new List<ClientWrapper>();
selClientIds = new Set<Id>();
for(Clients__c c : [Select Id, Name, RecordType from Clients__c where Name != null and active__c = true order by Name limit 999])
{
clientList.add(new ClientWrapper(c));
}
integer i = 0;
I then get this error message:
No such column 'RecordType' on entity 'Clients__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
I have confirmed that RecordType is the correct field name. It is a standard field. I have also tried selecting another standard field and I get the same mesage. When I try selecting a custome field I have no problem at all.
Can someone help pleae?
Thanks
I'm trying to make a simple change to this Apex code, trying to add RecordType to the list of fields displayed (see in bold):
public class AttendeeController{
// global List<SelectableAccount> accounts {get;private set;}
public List<ClientWrapper> clientList {get;set;}
public Set<Id> selClientIds {get;set;}
public Boolean hasSelClient {get;set;}
public String datename {get; set;}
public AttendeeController()
{
clientList = new List<ClientWrapper>();
selClientIds = new Set<Id>();
for(Clients__c c : [Select Id, Name, RecordType from Clients__c where Name != null and active__c = true order by Name limit 999])
{
clientList.add(new ClientWrapper(c));
}
integer i = 0;
I then get this error message:
No such column 'RecordType' on entity 'Clients__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
I have confirmed that RecordType is the correct field name. It is a standard field. I have also tried selecting another standard field and I get the same mesage. When I try selecting a custome field I have no problem at all.
Can someone help pleae?
Thanks
RecordType itself is not a field.
You have to use the fields of RecordType in your query.
For Eg : If you want Id of RecordType than use RecordTypeId and if you want name of RecordType than use RecordType.Name.
Please let me know if you need more clarification or any help on this.
Thanks,
Abhishek
All Answers
RecordType itself is not a field.
You have to use the fields of RecordType in your query.
For Eg : If you want Id of RecordType than use RecordTypeId and if you want name of RecordType than use RecordType.Name.
Please let me know if you need more clarification or any help on this.
Thanks,
Abhishek
Refer this link .It has the best answer for same type of question
http://salesforce.stackexchange.com/questions/33805/soql-obtaining-record-type-name
Thanks
If this solution is really helpful for you then please mark it best or solve that should be useful for outher.
Thanks