Newer Version Available
describeApprovalLayout()
Retrieves metadata about approval layouts for the specified object type.
Syntax
1DescribeApprovalLayoutResult approvalLayoutResult = connection.describeApprovalLayout(string sObjectType, string[] approvalProcessNames);Usage
Use this call to retrieve information about the approval layout for a given object type. Each approval process has one approval layout.
If you supply a null value for approvalProcessNames, all the approval layouts for the object are returned, instead of the approval layout of each specified approval process.
Sample Code—Java
This sample shows how to get the approval layouts of an Account sObject. It calls describeApprovalLayout() with the name of the sObject type to describe. After getting the approval layouts, the sample prints the name and fields found for each approval layout.
1public void describeApprovalLayoutSample() {
2 try {
3 String objectToDescribe = "Account";
4 DescribeApprovalLayoutResult approvalLayoutResult =
5 connection.describeApprovalLayout(objectToDescribe, null);
6 System.out.print("There are " + approvalLayoutResult.getApprovalLayouts().length);
7 System.out.println(" approval layouts for the " + objectToDescribe + " object.");
8
9 // Get all the approval layouts for the sObject
10 for (int i = 0; i < approvalLayoutResult.getApprovalLayouts().length; i++) {
11 DescribeApprovalLayout aLayout = approvalLayoutResult.getApprovalLayouts()[i];
12 System.out.println(" There is an approval layout with name: " + aLayout.getName());
13 DescribeLayoutItem[] layoutItems = aLayout.getLayoutItems();
14 System.out.print(" There are " + layoutItems.length);
15 System.out.println(" fields in this approval layout.");
16 for (int j = 0; j < layoutItems.length; j++) {
17 System.out.print("This approval layout has a field with name: ");
18 System.out.println(layoutItems[j].getLabel());
19 }
20 }
21 } catch (ConnectionException ce) {
22 ce.printStackTrace();
23 }
24}Arguments
| Name | Type | Description |
|---|---|---|
| sObjectType | string | The specified value must be a valid object for your organization. If the object is a person account, specify Account, or if it is a person contact, specify Contact. |
| approvalProcessNames | string[] | Optional array of the approval process API names to return approval layout metadata for. |