0

Using Force.com Tooling API(REST),How do I get the page layout-record type assignments for the given profile id?

Requesting with

/services/data/v36.0/tooling/query?q=Select+Name,+Metadata+From+Profile+where+Id='00eXX000000XXXX'+limit+1

responds with blank nodes for recordtypes etc.

Is it even possible to retrieve the full metadata of Profile object with Tooling API?

Sachi
  • 1
  • 1
  • 3

1 Answers1

0

In short term, the layout assignment information is listed in RecordType instead of Profile.

When you retrieve whole SObject Describe from this endpoint:

/services/data/v40.0/sobjects/Account/Describe

The response have a "recordTypeInfos" section like this:

[
{available: true, defaultRecordTypeMapping: true, master: false, name: "Account Name 1", recordTypeId: "xxx", …},
{available: true, defaultRecordTypeMapping: false, master: false, name: "Account Name 2", recordTypeId: "xxx", …},
{available: true, defaultRecordTypeMapping: false, master: true, name: "Account Name 3", recordTypeId: "xxx", …}
]

For each recordTypeInfo, it contains a value called url:

url:{layout:"/services/data/v40.0/sobjects/Account/describe/layouts/YourRecordTypeId"}

If you send a GET request to this endpoint, in the response you will see the Layout Id in:

{id: YourLayoutId}

So the mapping is already done by salesforce. That layout id reflects the layout assigned to the current user.