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
Carl PierreCarl Pierre 

INVALID FIELD Problem

The fields listed below are listed in my SalesForce dashboard and their Api names are well spelled but I have an error message when I included them in my request for getting campaigns.
  • Owner
  • Objective__c
  • Tactic
  • Landing_Page__c
 
There  is the error message:
 
No such column '[fields]' on entity 'Campaign'. 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.","errorCode":"INVALID_FIELD"}],

PS: I'm using REST API and PHP

an idea?
Best Answer chosen by Carl Pierre
venkat-Dvenkat-D
Owner is not a direct field . If you want id user OwnerId or if you want name use Owner.Name

All Answers

Deepak GulianDeepak Gulian
Please share the code where you are using the above custom fields
Carl PierreCarl Pierre
$qfields = implode(', ', $this->fields);
 $query = "SELECT $qfields from Campaign LIMIT 100";
 $url = "$instance_url/services/data/v20.0/query?q=" . urlencode($query);

 $curl = curl_init($url);
 curl_setopt($curl, CURLOPT_HEADER, false);
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($curl, CURLOPT_HTTPHEADER, array("Authorization: OAuth $access_token"));

$json_response = curl_exec($curl);

 $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ($status != 200) {
      die("Error: status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));
 }

curl_close($curl);

return json_decode($json_response, TRUE);

 
venkat-Dvenkat-D
Owner is not a direct field . If you want id user OwnerId or if you want name use Owner.Name
This was selected as the best answer
Carl PierreCarl Pierre
Thank you!!
venkat-Dvenkat-D
please mark as resolved