[SalesForce] Fields missing from API request

I'm doing API requests via the PHP library (https://github.com/phpforce/soap-client), and I'm using the enterprise WSDL.

Everything is working fine, but with one exception – some of the fields are not being returned via the API. Its not like they are null; instead they have been completely omitted. These are all new fields that have been added in Salesforce recently. Older fields (that have been there for a while) all return correctly.

The fields have definitely been spelled correctly, because if I make an intentional typo, then the API throws an error. So the fields definitely exist in Salesforce, but they just are not returned at all in the API.

Is there some kind of permissions that need to be set up in Salesforce, or something else that we are missing?

I've made sure to run the following script

ini_set("soap.wsdl_cache_enabled", "0");

Thanks for the help!

Edit
I've just tried returning all fields for the object:

$objects = $client->describeSObjects(['Account']);

foreach ($objects as $object)
{
    foreach($object->getFields() as $key => $field)
    {
        print_r($field->getName() . PHP_EOL);
    }
}

And I can clearly see the new fields ARE there. I confirm that the WSDL was definitely created after the new fields were created, and if I examine that WSDL, the new fields are indeed listed.

Unfortunately I can't use the Partner WSDL, because the library doesn't support it 🙁

Best Answer

It is either a permissions issue or the WSDL was generated before the fields were present in the org.

Try using the partner wsdl and do a describe on the object and see if the fields come back

Also, are the fields populated with values on the record you are querying?

If the field is not populated it will not be returned

If they are not populated, then populate them and retry the query to see if they are now returned

Related Topic