Skip to main content

When attempting to use SF_Metadata to retrieve metadata from CustomField, the MetadataXML column is never populating. The Member and Id columns are populating when I use the List operation, and executing the proc with the Retrieve operation appears to succeed, but the MetadataXML column remains NULL.

CustomObject and the other tooling objects I’ve worked with have worked fine.

This behavior is not confined to a single org. I have confirmed it against three orgs so far.

I’ve tried querying CustomField directly in a query using the four-part object identifier, but I get an error
Msg 7314, Level 16, State 1, Line 1

The OLE DB provider "MSOLEDBSQL" for linked server "<linked server name here>" does not contain the table ""CData"."Salesforce"."CustomField"". The table either does not exist or the current user does not have permissions on that table.


I am able to successfully query the CustomField object in the org via SOQL through Inspector and Workbench to retrieve metadata. 

I’ve done a fair amount of research and am coming up empty. Has anyone else run into this issue and found a way to get the CustomField MetadataXML populated?

Thanks!

Hi Tim! I know we found the answer when you came into the support box as well, but I wanted to go ahead and post what we found here so others can benefit!

 

Looking over Salesforce docs, that seems to me that is expected behavior with how the API is designed. According to their docs page on the CustomField aspect of the Metadata API, ""w]hen you retrieve a custom or standard object, you return everything associated with the object, except for standard fields that aren't customizable. You can also retrieve only specific fields for an object by explicitly naming the object and fields in package.xml." https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customfield.htm  

So it seems like to retrieve the Custom Field information, you would be making a call to the Custom Object it belongs to. 

As for querying it directly, that is definitely expected DBAmp behavior. The only way that DBAmp interfaces with the Metadata API is through SF_Metadata, it does not expose it as tables.

Another note to make here is that “CustomField” shows up as an object in Salesforce’s Metadata API as well as in the Tooling API. The Tooling API and the Metadata API are related (namely in that everything in the Metadata API is included in the Tooling API, according to Salesforce's documentation, and as you noted) but they are not the same thing. So the information that will be returned for fields from an SF_Metadata call to CustomObject will be the information from the Metadata API version of the object.


Reply