function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Wassim GhannoumWassim Ghannoum 

SalesForce SQL Query

Hi All,

I am trying to write a query that export all the data of leads (the data that we need to export is available under (App Setup -> Customize -> Leads -> Fields), i am able to export some fields, but when trying to access some fields i am getting an SQL Error:

(No such column 'Address' on entity 'Lead'. 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.)



this is the list of the fields that we need to export using our php code:

- Address

- AnnualRevenue

- Campaign

- Company

- CreatedBy

- Jigsaw

- Industry

- LastModifiedBy

- LastTransferDate

- Owner

- RecordType

- NumberOfEmployees

- Rating

- Title

- Correlation_Data

- CorrelationID

- ProductInterest

- Financial_Product

- IB

- iContact_Contact_Id

- Lead_Number

- Lead_Source_Details

- Lead_Type

- Web_to_x_Lead

- Web_to_x_form_id

- Preferred_Communication

- Round_Robin_ID

- Trading_Softwae

- VIP_Customer

- Web_Source

I appreciate your help

Best Answer chosen by Wassim Ghannoum
Ankit AroraAnkit Arora
These are too many :O

See I can give you some samples like for campign try with these fields :

Campaign

- CreatedBy -> CreatedById or CreatedBy.Id

- LastModifiedBy -> LastModifiedById or LastModifiedBy.Id

I hope you got the sense what am trying to say?

All Answers

Ankit AroraAnkit Arora
Some native fields of native objects are not directly accessible like Address check here : https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_lead.htm

To access the complete address you've to use these :

City
Country
CountryCode
Latitude (beta)
Longitude (beta)
PostalCode
State
StateCode
Street

For complete list visit here :

https://www.salesforce.com/us/developer/docs/api/Content/compound_fields_address.htm

These are compound fields and not directly accessible in code.
Wassim GhannoumWassim Ghannoum
thank you for your reply Ankit,

I already tested these fields to access a complete the address and it worked for me, but the issue is not for the address field only.. as i need to reference many other fields:

Campaign

- Company

- CreatedBy

- Jigsaw

- Industry

- LastModifiedBy

- LastTransferDate

- Owner

- RecordType

- NumberOfEmployees

- Rating

- Title

- Correlation_Data

- CorrelationID

- ProductInterest

- Financial_Product

- IB

- iContact_Contact_Id

- Lead_Number

- Lead_Source_Details

- Lead_Type

- Web_to_x_Lead

- Web_to_x_form_id

- Preferred_Communication

- Round_Robin_ID

- Trading_Softwae

- VIP_Customer

- Web_Source

i know that those fields are not accesible via a query on the lead object, but sure there should be another way to export these data
Ankit AroraAnkit Arora
These are too many :O

See I can give you some samples like for campign try with these fields :

Campaign

- CreatedBy -> CreatedById or CreatedBy.Id

- LastModifiedBy -> LastModifiedById or LastModifiedBy.Id

I hope you got the sense what am trying to say?
This was selected as the best answer
Wassim GhannoumWassim Ghannoum
yes Thank you,
it's clear now