Object Layout Information
Retrieving Layout Metadata
The Object Layout API allows developers to retrieve Salesforce Describe Layout metadata using the getLayout API. This metadata provides details about the structure of record pages, including field arrangements, field properties that may affect how they are displayed or edited, layout sections, and associated Record Types. The response is an object (Pulsar 12.0+) or JSON string (Pulsar 11.0 or lower) representing the DescribeLayoutResult from Salesforce
This API supports two key operations:
getLayout– retrieves full layout metadatagetLayoutSections– retrieves only section metadata, useful for display/edit modes
Method: getLayout
Description
Returns full layout metadata for a given Salesforce object and optional Record Type.
Request Parameters
type(string, required) – Must be set to"getLayout"to indicate a getLayout operation.object(string, required) – The name of the Salesforce SObject to create (e.g.,"Account","Contact").data(object, required) – There are two optional key-value pairs you can provide with this object.RecordTypeId(string, optional) – Represents the record type Id of theobject.RecordTypeName(string, optional) – Represents the record type developer name of theobject. This value will take precedence over the RecordTypeId field.
Example:
var request = {
type: 'getLayout',
object: 'Account', // Required: SObject unique name
data: {
// The following two parameters are optional, and only one is needed
// to specify the RecordType, though if both are specified,
// the RecordTypeName will take precedence
RecordTypeId: '012000000000000AAA', // Optional: Id of the RecordType
RecordTypeName: 'Business_Account', // Optional: RecordType Developer Name
}
};
bridge.send(request, function (result) {
if (result.type === 'layoutResponse') { // case-sensitive
var describeLayoutObject = result.data;
var describeLayout = (typeof describeLayoutObject === 'string') ?
JSON.parse(describeLayoutObject) : describeLayoutObject;
//....
}
else {
console.log('error: '+ result.data)
}
});Response
If successful:
{
"type": "layoutResponse",
"data": {
...a describe layout result object
}
}In versions prior to 12.0, the data object will be a string representation of the object above. JSON.parse will be needed to convert it into a useful value.
Error response:
{
"type": "error",
"data": "Error fetching layout", // or some useful error message
}Example Usage
The following handles all versions.
bridge.send(request, function(result) {
if (result.type === 'layoutResponse') {
const describeLayout = typeof result.data === 'string'
? JSON.parse(result.data)
: result.data;
// handle layout data
} else {
console.error('Layout fetch failed:', result.data);
}
});
Method: getLayoutSections
Description
Returns layout sections for a specific object and layout mode (e.g., edit or display).
Request Parameters
type(string, required) – Must be set to"getLayoutSections"to indicate a getLayoutSections operation.object(string, required) – The name of the Salesforce SObject to create (e.g.,"Account","Contact").data(object, required) – There are two optional key-value pairs you can provide with this object.RecordTypeId(string, optional) – Represents the record type Id of theobject.RecordTypeName(string, optional) – Represents the record type developer name of theobject. This value will take precedence over the RecordTypeId field.LayoutMode(string, optional) – Valid values are'display'and'edit'. The default value is'display'.
Response
If successful:
{
"type": "layoutSectionsResponse",
"data": [
{
"display": "TRUE", // indicates if the section header is visible
"heading": "A Heading Label",
"section": "0", // ordering of the sections from top to bottom in ascending order
},
{ ...another layout section entry },
...
]
}Error response:
{
"type": "error",
"data": "Error fetching layout sections", // or some useful error message
}Example Usage
Get the edit layout sections for the Account records with RecordTypeName ‘Business_Account’.
const request = {
type: 'getLayoutSections',
object: 'Account',
data: {
RecordTypeName: 'Business_Account', // Optional
LayoutMode: 'edit' // Optional: defaults to 'display'
}
};
bridge.send(request, function(result) {
if (result.type === 'layoutSectionsResponse') {
const layoutSections = result.data;
// handle layout sections
} else {
console.error('Failed to fetch layout sections:', result.data);
}
});
Method: getLayoutFields
Description
Returns a flattened list of field metadata for a given object's layout. This includes standard fields and any subcomponent fields (e.g., parts of an address field). The layout mode can be set to "edit" or "display" to retrieve metadata appropriate for those contexts.
Request Parameters
type(string, required) – Must be set to"getLayoutFields"to indicate a getLayoutFields operation.object(string, required) – The name of the Salesforce SObject to create (e.g.,"Account","Contact").data(object, required) – There are two optional key-value pairs you can provide with this object.RecordTypeId(string, optional) – Represents the record type Id of theobject.RecordTypeName(string, optional) – Represents the record type developer name of theobject. This value will take precedence over the RecordTypeId field.LayoutMode(string, optional) – Valid values are'display'and'edit'. The default value is'display'.
Response
If successful:
{
"type": "layoutFieldsResponse",
"data": [
{
"tabOrder": "1",
"editableForUpdate": "FALSE",
"editableForNew": "FALSE",
"placeHolder": "FALSE",
"label": "Account Name",
"type": "Field",
"required": "FALSE",
"displayLines": "1",
"name": "Name"
},
{ ...another layout field entry },
...
]
}Error response:
{
"type": "error",
"data": "Error fetching layout fields", // or some useful error message
}Example Usage
Get the edit layout fields for the Account records with RecordTypeName ‘Business_Account’.
const request = {
type: 'getLayoutFields',
object: 'Account', // Required: SObject API name
data: {
RecordTypeName: 'Business_Account', // Optional (takes precedence)
LayoutMode: 'edit' // Optional: defaults to 'display'
}
};
bridge.send(request, function(result) {
if (result.type === 'layoutFieldsResponse') {
const layoutFields = result.data;
console.log(layoutFields);
} else {
console.error('Failed to fetch layout fields:', result.data);
}
});