0

I am new to salesforce development, I am trying to get the user information on entering the phone number from my contacts which is successfully done. I want to create a call log on getting the user information such as in below image. The task is generated when I omit the CallType and ActivityType fields but the log is created under 'Activity Timeline' tab

enter image description here

My code is as following

$url = "$instance_url/services/data/v20.0/sobjects/Task";

  $content = json_encode(array(
    "Subject"=>'Call',
    "WhoId"=>$name,
    "Status"=> 'not started', // or 'Completed',
    "Description"=>'Description it is',
    "Priority"=>'Normal',
    "CallType "=>'Outbound',
    "ActivityType"=>'Call',
    "ActivitySubtype"=>'Call'

  ));


$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",

     "Content-type: application/json"));

  curl_setopt($curl, CURLOPT_POST, true);

  curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

  $json_response = curl_exec($curl);

  $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

  if ( $status != 201 ) {

   die("Error: call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));

 }

I am getting this error

Error: call to URL https://ap5.salesforce.com/services/data/v20.0/sobjects/Task failed with status 400, response [{"message":"No such column 'ActivitySubtype' on sobject of type Task","errorCode":"INVALID_FIELD"}], curl_error , curl_errno 0

enter image description here

i have looked up into this link for reference

link

Please help me with this.

1

I think you are using long old version 20.0.

Prefer to use latest version like this:

https://ap5.salesforce.com/services/data/v42.0/sobjects/Task

You should get desired result.

  • still getting the same error – Rishi May 28 '18 at 8:38
0

From the documentation here

The field with API name ActivitySubtype is visible in API version 35.0 and above for the object named AcitivityHistory. It Provides standard subtypes to facilitate creating and searching for specific activity subtypes. This field isn’t updateable.

  • the error is also getting for "CallType " and "ActivityType" fields – Rishi May 28 '18 at 8:41
  • What is the error you are getting for these fields. – ManishG May 28 '18 at 9:32
  • this one.... Error: call to URL ap5.salesforce.com/services/data/v42.0/sobjects/Task failed with status 400, response [{"message":"No such column 'CallType ' on sobject of type Task","errorCode":"INVALID_FIELD"}], curl_error , curl_errno 0 – Rishi May 28 '18 at 9:41
0

ok i got it.

I searched for the api versions which are currently available , altered the version to 40.0, removed attributes "CallType, ActivityType, ActivitySubtype " and added "TaskSubType"=>'call'. It logged a call.

Might help others facing same issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.