Problem: need to know who and when created and/or last modified the custom metadata type object. This information is captured in various system fields on the object. The screenshot shows two such fields - Created By
and Modified By
, their values have been redacted for public consumption:
1 Answer
The values of system fields on the custom metadata object are only available via Tooling API. In the ontology of entities covered by Tooling API, you will not find a Custom Metadata entity. This is so because underneath the hood the custom metadata object is represented as a...custom object. Full list of system fields is documented; some of these fields aren't shown on the custom metadata type object definition screen.
The easiest way to grab this data from Tooling API is via REST using the query
resource. To do so, you need to know the Object Name of custom metadata type. The value of Object Name can then be used to compose a DeveloperName
predicate in a query against CustomObject
entity:
/services/data/v49.0/tooling/query/?q=SELECT+Id,CreatedById,CreatedDate,LastModifiedById,LastModifiedDate+FROM+CustomObject+WHERE+DeveloperName='Truck_Configurations'
Response with redacted values:
{
"size" : 1,
"totalSize" : 1,
"done" : true,
"queryLocator" : null,
"entityTypeName" : "CustomObject",
"records" : [ {
"attributes" : {
"type" : "CustomObject",
"url" : "/services/data/v49.0/tooling/sobjects/CustomObject/01I..."
},
"Id" : "01I...",
"CreatedById" : "005...",
"CreatedDate" : "...",
"LastModifiedById" : "005...",
"LastModifiedDate" : "..."
} ]
}