I'm trying to use the SOAP version of the Winter 13 (v29.0) Tooling API to query the CustomField
records and the associated CustomFieldMetadata
Metadata field.
The following query works without the Metadata field:
Select Id, DeveloperName, FullName, NamespacePrefix, TableEnumOrId from CustomField where TableEnumOrId = 'Contact' order by DeveloperName limit 100
If I add the Metadata
field to the query I get an error back from the API:
Select Id, DeveloperName, FullName, NamespacePrefix, TableEnumOrId, Metadata from CustomField where TableEnumOrId = 'Contact' order by DeveloperName limit 100
System.Web.Services.Protocols.SoapHeaderException]: {"Unable to serialize property of 'records' on type common.api.soap.wsdl.QueryResult Error Id: 716379696-38882 (-43640737)"}
The same SOQL query works in the developer console in a Spring 14 Org when "Use Tooling API" is checked. The developer console only shows the Metadata
as "[object Object]".
I can't be sure, but I suspect the developer console is using the REST API. At the very least it shows it should be possible to get the field with SOQL.
Is this a Spring 14 vs. Winter 13 difference, or a SOAP vs. REST thing?
Attribution to: Daniel Ballinger
Possible Suggestion/Solution #1
From the Tooling API documentation for CustomField.Metadata
Query this field only if the query result contains no more than one record. Otherwise, an error is returned. If more than one record exists, use multiple queries to retrieve the records. This limit protects performance.
Attribution to: Daniel Ballinger
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/32809