Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Question: How should I determine which layout to render for an object?

From my research, I think this can be done by looking at the RecordTypeId for an object, and then querying the layouts to find a layout that has the same RecordTypeId (i.e. sobjects/event/describe/layouts.)

However, if this is the correct approach, multiple layouts can exist for a RecordType, so I am left unsure of how to find the correct layout to Render.

Sub-Question: Should I be using the RecordTypeId on the object to get to the layout, or perhaps use the user's profile to find which RecordType's they have access to, and go from there.

Note: I'm using version 31.0 of the REST API

share|improve this question
up vote 4 down vote accepted

You're on the right track; use the describe resource on the record (e.g. /vxx.x/sobjects/Object/describe/), and in that response, you'll see a section like this:

"recordTypeInfos": [
        "available": true,
        "defaultRecordTypeMapping": false,
        "name": "<record-type-name>",
        "recordTypeId": "<record-type-id>",
        "urls": {
            "layout": "/services/data/v30.0/sobjects/Object/describe/layouts/<record-type-id>"

Find the record type ID that matches the one you got from retrieving the record, and call that layout function. The system will automatically determine which layout is correct for your record type, given the profile you are logged in with.

Also, if you need to know which record type the user has access to, just look at the "available" attribute. The "defaultRecordTypeMapping" element specifies if this profile is using this record type as the default.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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