Versions Compared

Key

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

Retrieving Layout Metadata

Pulsar can provide Salesforce Describe Layout metadata using the getLayout API. The response is DescribeLayout JSON object string .

...

Code Block
languagejs
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 Id will take precedence
       RecordTypeId: '012000000000000AAA', // Optional: Id of the RecordType
       RecordTypeName: 'Business_Account', // Optional: RecordType Developer Name
    }     
};
bridge.sendRequest(request, function (result) {
   if (result.type === 'layoutResponse') { // case-sensitive
      var describeLayoutJSON = result.data;
      var describeLayout = JSON.parse(describeLayoutJSON);
      //....
   }
   else {
      console.log('error: '+ result.data)
   }
});

Retrieving Layout Section Metadata

Pulsar can provide Salesforce Describe Layout section information using the getLayoutSections API. The response is an array of section dictionaries that exist within the selected layout. The parameters are the same as the getLayout API, with an additional parameter to select the mode (“edit” or “display”).

...

Code Block
languagejs
var request = {
    type: 'getLayoutSections',
    object: 'Account', // Required: SObject unique name 
    data: {
       // The following two parameters are both optional, and only one is needed
       //  to specify the RecordType, though if both are specified, 
       //  the Id will take precedence
       RecordTypeId: '012000000000000AAA', // Optional: default Id is shown here
       RecordTypeName: 'Business_Account', // Optional: RecordType Developer Name
       LayoutMode: 'edit', // Optional: default is 'display'
    }     
};
bridge.sendRequest(request, function (result) {
   if (result.type === 'layoutSectionsResponse') { // case-sensitive
      var layoutSections = result.data;
      // Example results with explanation:
// [
//     {
//         "display": "FALSE", // string indicating visibility of a section header
//         "heading": "Top of Page", // heading text as defined in the layout
//         "section": "0" // logical section ordering as it appears on the page
//     },
//     {
//         "display": "TRUE",
//         "heading": "Work Order Detail",
//         "section": "1"
//     },
//     {
//         "display": "TRUE",
//         "heading": "Ticket Contact",
//         "section": "2"
//     },
//     {
//         "display": "TRUE",
//         "heading": "Service Report",
//         "section": "3"
//     },
//     {
//         "display": "TRUE",
//         "heading": "Entitlement",
//         "section": "4"
//     },
//     {
//         "display": "TRUE",
//         "heading": "System Info",
//         "section": "5"
//     }
// ]
//...
   }
   else {
      console.log('error: '+ result.data)
   }
});

Retrieving Layout Field Metadata

Pulsar can provide Salesforce Describe Layout field data using the getLayoutFields API. The response is a flattened array of field dictionaries that exist on the selected layout. Note that layout fields with subcomponents will exist alongside the subcomponent fields themselves. The parameters are the same as the getLayout API, with an additional parameter to select the mode (“edit” or “display”).

...