Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

How to list the Salesforce Meta Data using SOAP / PHP

Be First!
by March 8, 2013 PHP, SALESFORCE

How to list the Salesforce Meta Data using SOAP / PHP

In you php code initialize the PHP and Salesforce connection and use below code:

try
{
//salesforce login and wsdl
if (isset($client))
{
// Retrieve all the objects in the organization
$result = $client->describeGlobal();

// Cycle through each object
foreach ($result->types as $objectType)
{

// Retrieve the object definition
$resultObject = $client->describeSObject($objectType);

echo "<strong><u>" . $objectType . "</u></strong><br />\n";

// Cycle through each field

foreach ($resultObject->fields as $field)
{
echo $field->name . "<br />\n";

}
}
}

}
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;
exit;
}
?>

(788)

Previous
Next

Leave a Reply