I'm using the jsforce node package and I've tried the following:

        apiVersion: '38.0',
        unpackaged: {
            types: [
                    members: ['Contact'],
                    name: 'Layout'

Which results in the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

I'm not sure where to retrieve all layouts from. I can do it via the describeLayouts() endpoint, but that seems to exclude the actual layout names which I definitely need.

I referenced this question and turned to the metadata file-based API calls which is shown above. I also did name: 'CustomObject' but it wasn't part of that response either. Any ideas?

Edit with REST API response: enter image description here


Use the Tooling API to query for the layouts:

SELECT FullName FROM Layout WHERE TableEnumOrId = 'Contact'

You can read more about the Tooling API REST Calls.

Here's the raw endpoint you would use:


Example Output:

  "size" : 1,
  "totalSize" : 1,
  "done" : true,
  "queryLocator" : null,
  "entityTypeName" : "Layout",
  "records" : [ {
    "attributes" : {
      "type" : "Layout",
      "url" : "/services/data/v38.0/tooling/sobjects/Layout/00h50000000yfyCAAQ"
    "FullName" : "Contact-Magical Happy Land"
  } ]
  • Yeah I was trying to give that a shot, but didn't see the actual name of the layout coming back, just the record type name Jan 13 '17 at 20:14
  • see my edit with the response from that endpoint. The names in this section are the record type names and I didn't see anything in the Layouts section to indicate a layout name Jan 13 '17 at 20:22
  • @MattAltepeter Found an answer in the tooling API. Take a peek.
    – sfdcfox
    Jan 13 '17 at 20:48
  • 4
    One caveat for future readers: selecting the FullName attribute can only be done when the result will return exactly one layout. Use Name instead to get all the layout names Jan 20 '17 at 18:10
  • 1
    @doga Yes, TableEnumOrId needs to be the Custom Object Id for custom objects. Use a query on CustomObject to find the Id that you need to use.
    – sfdcfox
    Sep 17 '18 at 8:15

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.