1

have been trying to use the php toolkit to create a task for a while and am stuck.

This is the code I am using currently:

$mySforceConnection = new SforceEnterpriseClient();
$mySforceConnection->createConnection(SALESFORCE_WSDL);
$mySforceConnection->login(SALESFORCE_USERNAME, SALESFORCE_PASSWORD.SALESFORCE_SECURITY_TOKEN);

$sObject = new stdclass();
$sObject->Owner = 'XXXXXXXXXXXXXXXX';
$sObject->ActivityDate = date('Y-m-d');
$sObject->Description = 'Description';
$sObject->Status = 'Not Started';
$sObject->Priority = 'Normal';
$sObject->Subject = 'Call this guy';
$sObject->Type = 'Other';
$sObject->WhatId = 'XXXXXXXXXXXXXXXX';
$createResponse = $mySforceConnection->create(array($sObject), 'Task');

And this is the error I get:

Fatal error: Uncaught SoapFault exception: [sf:INVALID_TYPE] INVALID_TYPE: Must send a concrete entity type.

Any ideas?

I am trying to create a task attached to a specific lead/account and then I need to create a task that is just attached to a specific user.

Thanks

EDIT:

This is my final solution using the partner wsdl:

$fields = array (
    'ActivityDate' => date('Y-m-d'),
    'Status' => 'Not Started',
    'Description' => 'new lead',
    'Subject' => 'call this guy',
    'WhatId' => $account_id,
);

$sObject = new SObject();
$sObject->fields = $fields;
$sObject->type = 'Task';
$createResponse = $mySforceConnection->create(array($sObject));

1 Answer 1

0

Have you tried switching to the Partner WSDL? I've seen people with the same issue and switching to use Partner WSDL solved it. Unfortunately, I don't know what the root cause is.

4
  • I switched to the partner WSDL and got farther, I'm now getting the error: The external foreign key reference does not reference a valid entity: Owner
    – bones
    Commented Apr 28, 2015 at 12:59
  • Try using OwnerID instead. Commented Apr 28, 2015 at 13:31
  • Got: "Assigned To ID: id value of incorrect type:" Is the owner id the id of the account that the task is attached to or the id of the user?
    – bones
    Commented Apr 28, 2015 at 13:48
  • OwnerId is the user, WhatId would be for the Account, WhoId would be for the Contact Commented Apr 28, 2015 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .