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 IdRecordTypeName 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)
}
}); |