1

In a previous question, I had asked how to determine which layout was correct to render for a user, based on the organization's security and the user's profile. The answer was to use record types to help look this info up. Since then, I have come across a situation where the object whose layout I want to render does not have record type info to base a layout rendering decision upon.

For example, in my organization, if I run a describe on the User object, the recordTypeInfos object is an empty array.

{
   ...
  "recordTypeInfos": [],
   ...
  "urls": {
    ...
    "/services/data/v31.0/sobjects/User/describe/layouts"
    ...
   }
}

}

  1. When there is no record type/profile to help chose which layout to render, what layout do I render? Please take user and system security into this question.
  2. Are there some objects that cannot be rendered, because perhaps they don't have a layout? If so, how would I determine this? I noticed that when describing an object, it can have a layoutable value of true or false, and I wondered if this had anything to do with it (reference).

Using REST API version 31.0

2
  1. Call the resource mentioned in your question. Despite being called "layouts", it will return the correct layout for your profile; only one layout should return. If you want all layouts, you need the metadata API. The rest API isn't an administrative API, as it's designed to support mobile device access. As such, there is very little magic or trickery in the API, and you should generally accept what you see at face value.

  2. If layoutable is false, there is no layout for the record. For example, AccountShare can't be laid out, because it's not customizable, nor can you see an AccountShare by itself. In this case, you'll have to choose how to expose this object, if at all. These objects have special meaning in the system, and need to be handled in a different manner than a normal record.

2
  • Do you know why some objects would have record type info setup, and why others wouldn't (forcing to me use the describe/object/layout feature)? I'm curious on this from an admin side of things. Aug 1 '14 at 14:22
  • 1
    @contactmatt Admins can choose to configure record types on most objects. Choosing not to leaves you with just one layout per profile. Admins are responsible for choosing if they want to use record types, as they're never present by default.
    – sfdcfox
    Aug 1 '14 at 15:27

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.