Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Retrieving Compact Layout Metadata

Pulsar can provide Salesforce Compact Layout information using the getCompactLayoutFields API. The response is an array of field names that exist on the selected object’s compact layout. The parameters are the same as the getLayout API, with an additional required parameter for the ObjectType

...

Code Block
languagejs
var request = {
  type: 'getCompactLayoutFields',
  object: 'Contact',
  data: {
    // The following two parameters are both optional, and only one is needed
    //  to specify the RecordType, though if both are specified,
    //  the IdRecordTypeName will take precedence
    RecordTypeId: '012000000000000AAA', // Optional: default Id is shown here
    RecordTypeName: 'Business_Contact', // Optional: RecordType Developer Name
    ObjectType: 'Contact', // Required: SObject unique name
  }
};
bridge.sendRequest(request, function (result) {
  if (result.type === 'getCompactLayoutFieldsResponse') { // case-sensitive
    var layoutFields = result.data;
    // Example results:
// [
//     "Name",
//     "Email",
//     "Phone",
//     "MobilePhone",
//     "Title"
// ]
    //...
  }
  else {
    console.log('error: '+ result.data)
  }
});