Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SalesForce API query doesn't show custom fields

I have a custom date field for accounts in SalesForce: LastCheckedDate (API Name: LastCheckedDate__c)

I'm trying to use the SalesForce Enterprise API to query accounts based on that field. It returns results, and I can use the custom field in the WHERE part of the query, but I can't get it to actually show me the value of the custom field in the results.

This PHP code should get me the ID, name, and LastCheckedDate of any account that has been checked in 2011:

$query = "SELECT Id,Name,LastCheckedDate__c FROM Account WHERE LastCheckedDate__c > 2011-01-01";
$response = $salesforceConnection->query($query);

foreach ($response->records as $record) {               
    print_r($record);
}

It correctly only returns accounts that have been checked in 2011, but the result doesn't include the value of that custom field:

stdClass Object
(
    [Id] => 0015000000abcdefgh
    [Name] => Bob's Widget Factory
) 

How can I get it to include the LastCheckedDate in the results objects?

like image 332
NChase Avatar asked May 23 '11 23:05

NChase


People also ask

Why custom field is not showing in report Salesforce?

If a report based on a Custom Report Type does not contain all of the expected fields to add, you must edit the layout of the report type in question. For example, an 'Activities with Accounts and Contacts' report type is missing fields from the 'Select Columns' step of the Report Builder.

Why does Salesforce not show fields?

Click Profile. Under Apps, click Object Settings then click the object. Under Field Permissions, click Edit. Select the Read and Edit checkbox for the preferred fields they must see.


2 Answers

Update your wsdl file. So You can not select or update any field that are not in the wsdl file.

like image 76
kerem Avatar answered Oct 02 '22 04:10

kerem


Seems like you are having the same problem as is addressed in this question: SalesForce.com: Retrieve custom fields via PHP.

It is related to how you are parsing the returned data.

like image 24
lnediger Avatar answered Oct 03 '22 04:10

lnediger