<—php
ini_set("soap.wsdl_cache_enabled", "0");
require_once ('./includes/soapclient/SforcePartnerClient.php');
require_once ('./includes/soapclient/SforceHeaderOptions.php');
$wsdl = './includes/soapclient/partner.wsdl.xml';
$userName = "email@password.com";
$password = "password";
$client = new SforcePartnerClient();
$client->createConnection($wsdl);
$loginResult = $client->login($userName, $password);
try
{
$query = "Select WhatId FROM Task";
$queryOptions = new QueryOptions(500);
$response = $client->query(($query), $queryOptions);
// check count to see if we are done
if ($response->size > 0)
{
$accounts = $response->records;
// Cycles through additional responses if the number of records
// exceeds the batch size
while (!$response->done)
{
set_time_limit(100);
$response = $client->queryMore($response->queryLocator);
$accounts = array_merge($accounts, $response->records);
}
}
echo '<pre>' . print_r($accounts, true) . '</pre>';
exit;
}
catch (exception $e)
{
// This is reached if there is a major problem in the data or with
// the salesforce.com connection. Normal data errors are caught by
// salesforce.com
echo '<pre>' . print_r($e, true) . '</pre>';
return false;
}
–>
Not exactly. I know how to do that. The question is about how to determine the target object of the WhatId. In your example, you will get all the WhatId from the task object but how do you construct query to get the "Name" value for each returned WhatId?
WhatId can be associated with almost all the standard and custom objects. In my case, we have a dozen custom objects that can link to the WhatId. So we are looking for a quick way to determine what object is associated with the WhatId.
Not exactly. I know how to do that. The question is about how to determine the target object of the WhatId. In your example, you will get all the WhatId from the task object but how do you construct query to get the "Name" value for each returned WhatId?
Thanks,
Ted Tsung
~Mike
WhatId can be associated with almost all the standard and custom objects. In my case, we have a dozen custom objects that can link to the WhatId. So we are looking for a quick way to determine what object is associated with the WhatId.
Ted
http://www.salesforce.com/us/developer/tech-notes.jsp?tn=TN-1
--Alex