I want to create Task with 'Related To' (WhatId) field, where the type is 'Product'. But salesforce always says that malformed_id.
$fields = array (
'STATUS' => 'IN PROGRESS',
'PRIORITY' => 'NORMAL',
'WhoId' => 'xxxx',
'SUBJECT' => 'My Subject',
'WhatId' => 'MXD, // Existing Product code
'Type' => 'Download'
);
In case, if i gave AccountId. it works well, but need to insert 'Product Code'.
-- Update:
I found the solution:
I get the WhatId from 'Product2' table.
$product_response = $Connection->query("SELECT Id from Product2 WHERE ProductCode='CUSTOMPCODE'");
$data = (array) $product_response->records;
$whatid = $data[0]->Id[0];
after getting $whatid, then submitted to sales-force:
$fields = array (
'STATUS' => 'IN PROGRESS',
'PRIORITY' => 'NORMAL',
'WhoId' => 'xxxx',
'WhatId' => $whatid,
'SUBJECT' => 'My Subject',
'WhatId' => 'MXD, // Existing Product code
'Type' => 'Download'
);
it works well!
Thanks for who helped.