Im looking to use a combination of the tooling api object ProfileLayout and the SetupAuditTrail object. I can query the SetupAuditTrail and with a bit of parsing extract the names of any layouts that have changed, i then want to use this info in combination with ProfileLayout, however, this only contains the IDs of the Layouts.

So the Q is, is there any way to get the Id of a layout using the layouts name?


You can perform a Tooling API query for the Id:

SELECT Id FROM Layout WHERE Name = 'Account Layout'

GET /services/data/v44.0/tooling/query?q=SELECT+Id+FROM+Layout+WHERE+Name+=Account+Layout'

You can query other information this way too (see the Tooling API Layout object), but note that values like FullName and Metadata can only be retrieved if the result set contains exactly one record.

You'll probably want to query for Id first, based on the Name, to determine if there are any duplicates at the Name level, and then descend with single-record queries to finer detail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.