有没有办法从Salesforce Org获取标签列表?我尝试使用Metadata wsdl文件并使用force-wsc.jar创建了一个jar。但我无法检索选项卡列表。请帮忙或提供一些指示。提前谢谢。
答案 0 :(得分:0)
要获取有关Salesforce标签的信息,您可以使用SOAP API方法describeTabs()。以下是使用Java的示例:
public void describeTabsSample() {
try {
// Describe tabs
DescribeTabSetResult[] dtsrs = connection.describeTabs();
System.out.println("There are " + dtsrs.length +
" tab sets defined.");
// For each tab set describe result, get some properties
for (int i = 0; i < dtsrs.length; i++) {
System.out.println("Tab Set " + (i + 1) + ":");
DescribeTabSetResult dtsr = dtsrs[i];
System.out.println("Label: " + dtsr.getLabel());
System.out.println("\tLogo URL: " + dtsr.getLogoUrl());
System.out.println("\tTab selected: " +
dtsr.isSelected());
// Describe the tabs for the tab set
DescribeTab[] tabs = dtsr.getTabs();
System.out.println("\tTabs defined: " + tabs.length);
// Iterate through the returned tabs
for (int j = 0; j < tabs.length; j++) {
DescribeTab tab = tabs[j];
System.out.println("\tTab " + (j + 1) + ":");
System.out.println("\t\tName: " +
tab.getSobjectName());
System.out.println("\t\tLabel: " + tab.getLabel());
System.out.println("\t\tURL: " + tab.getUrl());
DescribeColor[] tabColors = tab.getColors();
// Iterate through tab colors as needed
DescribeIcon[] tabIcons = tab.getIcons();
// Iterate through tab icons as needed
}
}
} catch (ConnectionException ce) {
ce.printStackTrace();
}
}