How to Use the Entire Salesforce API, Part Three (Describe Calls, Enterprise and Partner WSDL Formats)
Here is part three of the series documenting the Salesforce API when used with the PHP Toolkit, where we’re going to cover the method calls under the ‘Describe Calls’ section of the API documentation. Note that this post applies to both the Enterprise and Partner WSDL formats.
Prerequisites
All examples below assume the Toolkit has been instantiated and the connection has been made:
Enterprise WSDL
$crmHandle = new SforceEnterpriseClient();
$crmHandle->createConnection(‘/path/to/enterprise.wsdl.xml’);
Partner WSDL
$crmHandle = new SforcePartnerClient();
$crmHandle->createConnection(’/path/to/partner.wsdl.xml’);
Additionally, all examples except login() assume you are logged in, using a call such as
$crmHandle->login(‘joe@example.com.sbox1′, ‘*passwordhere*’ . ‘*securitytokenhere*’);
Variable Names
- $crmHandle – reference to an instance of the Toolkit object
- $result – the result of a Salesforce method call
Notes
Date formats are in the SOAP dateTime format (ISO 8601), e.g. ‘2009-06-01T23:01:01Z’.
If you see an error like ‘INVALID_TYPE: Must send a concrete entity type’, most likely, you have forgotten to wrap your object in an array before passing it to a method.
describeGlobal()
$result = $crmHandle->describeGlobal();
describeLayout()
$result = $crmHandle->describeLayout('Lead', '*A VALID LEAD ID HERE*');
describeSObject()
NOTE: This method call is deprecated in favor of describeSObjects().
$result = $crmHandle->describeSObject('Lead');
describeSObjects()
$result = $crmHandle->describeSObjects(array('Lead'));
describeSoftphoneLayout()
NOTE: From the API docs: ‘Use only in the context of Salesforce CRM Call Center; do not call directly from client programs.’
describeTabs()
$result = $crmHandle->describeTabs();
