+ Start a Discussion
sudhansudhan 

No such columns error for standard fields on deploying to server from eclipse

I wrote this below apex code using eclipse and when i deploy to server and on validating it says no such column for address,owner,recordtype and created by. I tested with just Email and it worked perfectly. I even tried appending the column names with__c like custom fields but it didn't work.

 

public class Communication {
List<Lead> leads;
public List<Lead> getLeads() {
if(leads == null) leads = [select Address,Owner,RecordType,CreatedBy from lead limit 10];
return leads;
}
}

 

tell me how the standard fields should be represented using their api name.

Best Answer chosen by Admin (Salesforce Developers) 
gm_sfdc_powerdegm_sfdc_powerde

Use OwnerId,CreatedById, RecordTypeId.  There is no field for address, you will have to get City, State, Country and PostalCode separately.  When in doubt, always look for the API name of the field.

 

When in doubt, use describe call on sobject to get field details.  Here is the Apex documentation for describe feature - http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content%2Fapex_dynamic_describe_objects_understanding.htm|SkinName=webhelp

All Answers

gm_sfdc_powerdegm_sfdc_powerde

Use OwnerId,CreatedById, RecordTypeId.  There is no field for address, you will have to get City, State, Country and PostalCode separately.  When in doubt, always look for the API name of the field.

 

When in doubt, use describe call on sobject to get field details.  Here is the Apex documentation for describe feature - http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content%2Fapex_dynamic_describe_objects_understanding.htm|SkinName=webhelp

This was selected as the best answer
sudhansudhan
Thanks i corrected. Is there any possibility to retrieve the owner name instead of getting owner ID
DeeMakDeeMak
Use relation. Replace Owner with Owner.Name in your query