Object Layout Information

Retrieving Layout Metadata

Pulsar can provide Salesforce Describe Layout metadata using the getLayout API. The response is an object (Pulsar 12.0+) or JSON string (Pulsar 11.0 or lower) representing the DescribeLayoutResult from Salesforce

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.sendRequest(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) } });

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”).

Example:

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 RecordTypeName 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”).

Example:

var request = { type: 'getLayoutFields', 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 RecordTypeName 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 === 'layoutFieldsResponse') { // case-sensitive var layoutFields = result.data; // Example results: // [ // { // "tabOrder": "1", // "editableForUpdate": "FALSE", // "editableForNew": "FALSE", // "placeHolder": "FALSE", // "label": "Account Name", // "type": "Field", // "required": "FALSE", // "displayLines": "1", // "name": "Name" // }, // { // "tabOrder": "12", // "editableForUpdate": "FALSE", // "editableForNew": "FALSE", // "placeHolder": "FALSE", // "label": "Sales Territory", // "type": "Field", // "required": "FALSE", // "displayLines": "1", // "name": "Sales_Territory__c" // }, // { // "tabOrder": "2", // "editableForUpdate": "FALSE", // "editableForNew": "FALSE", // "placeHolder": "FALSE", // "label": "Customer Number", // "type": "Field", // "required": "FALSE", // "displayLines": "1", // "name": "Customer_Number__c" // }, // { // "tabOrder": "6", // "editableForUpdate": "FALSE", // "editableForNew": "FALSE", // "placeHolder": "FALSE", // "label": "Shipping Address", // "type": "Field", // "required": "FALSE", // "displayLines": "1", // "name": "ShippingAddress" // }, // { // "tabOrder": "7", // "parentFieldName": "ShippingAddress", // "parentFieldType": "Field", // "label": "Shipping Street", // "type": "textarea", // "required": "FALSE", // "displayLines": "1", // "name": "ShippingStreet" // }, // { // "tabOrder": "8", // "parentFieldName": "ShippingAddress", // "parentFieldType": "Field", // "label": "Shipping City", // "type": "string", // "required": "FALSE", // "displayLines": "1", // "name": "ShippingCity" // }, // { // "tabOrder": "9", // "parentFieldName": "ShippingAddress", // "parentFieldType": "Field", // "label": "Shipping State/Province", // "type": "string", // "required": "FALSE", // "displayLines": "1", // "name": "ShippingState" // }, // { // "tabOrder": "10", // "parentFieldName": "ShippingAddress", // "parentFieldType": "Field", // "label": "Shipping Zip/Postal Code", // "type": "string", // "required": "FALSE", // "displayLines": "1", // "name": "ShippingPostalCode" // }, // { // "tabOrder": "11", // "parentFieldName": "ShippingAddress", // "parentFieldType": "Field", // "label": "Shipping Country", // "type": "string", // "required": "FALSE", // "displayLines": "1", // "name": "ShippingCountry" // }, // { // "tabOrder": "17", // "editableForUpdate": "FALSE", // "editableForNew": "FALSE", // "placeHolder": "FALSE", // "label": "Preferred Language", // "type": "Field", // "required": "FALSE", // "displayLines": "1", // "name": "Preferred_Language__c" // } // ] //... } else { console.log('error: '+ result.data) } });