When I use simple-salesforce's Metadata api read method _sf.mdapi.CustomObject.read(sf_object_name)
, I get what seems to be a full list of fields from my object. However, if I use the describe method getattr(_sf, sf_object_name).describe()
, the metadata returned is missing dozens of fields. Why is that the case for the same object?
I'd prefer to use .describe(), since it returns usable picklistValues
vs. .read(), which sometimes gives a valueSetName
that doesn't include the actual picklist values, just the name of a valueSet which I'd have to re-query for.
Metadata read returns the "real" object definition plus lots of things you probably don't care about (listviews, action overrides, compact layouts, validation rules). It's aimed at admins/Devs that need to modify system configuration.
Describe will respect the field permissions you have so if there's stuff missing - somebody needs to fix your profile. Field level security, license for managed packages if there are any managed fields, if the field is a lookup you also need Read right to the object looked up... It's different use case aimed at giving you quick info what you can do (read/edit data, not metadata). And you don't need to be admin to run describes