Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
PermissionSetTabSetting
Supported SOAP Calls
create(), delete(), query(), retrieve(), update()
Supported REST HTTP Methods
Query, GET, POST, PATCH, DELETE
Special Access Rules
As of Spring ’20 and later, only users with View Setup and Configuration permission can access this object.
Fields
| Field Name | Details |
|---|---|
| Name |
|
| ParentId |
|
| Visibility |
|
Usage
To hide a tab, delete the associated PermissionSetTabSetting object. ParentId and Name fields can’t be updated.
1try {
2 // Query for the ID of the permission set owned by the System Administrator profile
3 String queryString = "SELECT Id FROM PermissionSet
4 + WHERE Profile.Name = 'System Administrator'";
5 QueryResult queryResult = connection.query(queryString);
6 if (queryResult.getSize() > 0) {
7 // Construct the tab setting sObject
8 PermissionSetTabSetting tabSetting = new PermissionSetTabSetting();
9 tabSetting.setParentId(queryResult.getRecords()[0].getId());
10 tabSetting.setName("CustomObject__c");
11 tabSetting.setVisibility(TabVisibility.DefaultOn);
12 SObject[] sObjects = new SObject[] { tabSetting };
13 // Create the tab setting
14 SaveResult[] saveResults = connection.create(sObjects);
15 for (SaveResult saveResult : saveResults) {
16 if (saveResult.isSuccess()) {
17 System.out.println("Successfully created the tab setting.");
18 System.out.println("ID: " + saveResult.getId());
19 } else {
20 Error error = saveResult.getErrors()[0];
21 System.out.println("Failed to create the tab setting.");
22 System.out.println("Status code: " + error.getStatusCode());
23 System.out.println("Message: " + error.getMessage());
24 }
25 }
26 } else {
27 System.out.println("Failed to find the ID of the permission set.");
28 }
29} catch (ConnectionException ce) {
30 ce.printStackTrace();
31}1try {
2 // Query for the ID of the tab setting for the Account tab on the Standard User profile
3 String queryString = "SELECT Id FROM PermissionSetTabSetting "
4 + "WHERE Parent.Profile.Name = 'Standard User' AND Name = 'standard-Account'";
5 QueryResult queryResult = connection.query(queryString);
6 if (queryResult.getSize() > 0) {
7 // Change the visibility
8 PermissionSetTabSetting tabSetting = (PermissionSetTabSetting)queryResult.getRecords()[0];
9 tabSetting.setVisibility(TabVisibility.DefaultOff);
10 // Update the tab setting
11 SObject[] sObjects = new SObject[] { tabSetting };
12 SaveResult[] saveResults = connection.update(sObjects);
13 for (SaveResult saveResult : saveResults) {
14 if (saveResult.isSuccess()) {
15 System.out.println("Successfully updated the tab setting.");
16 System.out.println("ID: " + saveResult.getId());
17 } else {
18 Error error = saveResult.getErrors()[0];
19 System.out.println("Failed to update the tab setting.");
20 System.out.println("Status code: " + error.getStatusCode());
21 System.out.println("Message: " + error.getMessage());
22 }
23 }
24 } else {
25 System.out.println("Failed to find the ID of the tab setting.");
26 }
27} catch (ConnectionException ce) {
28 ce.printStackTrace();
29}The example deletes the existing tab setting to make the Account tab hidden for the Standard User profile.
1try {
2 // Query for the ID of the tab setting for the Account tab on the Standard User profile
3 String queryString = "SELECT Id FROM PermissionSetTabSetting "
4 + "WHERE Parent.Profile.Name = 'Standard User' AND Name = 'standard-Account'";
5 QueryResult queryResult = connection.query(queryString);
6 if (queryResult.getSize() > 0) {
7 // Delete the tab setting
8 String[] ids = new String[] { queryResult.getRecords()[0].getId() };
9 DeleteResult[] deleteResults = connection.delete(ids);
10 for (DeleteResult deleteResult : deleteResults) {
11 if (deleteResult.isSuccess()) {
12 System.out.println("Successfully deleted the tab setting.");
13 System.out.println("ID: " + deleteResult.getId());
14 } else {
15 Error error = deleteResult.getErrors()[0];
16 System.out.println("Failed to delete the tab setting.");
17 System.out.println("Status code: " + error.getStatusCode());
18 System.out.println("Message: " + error.getMessage());
19 }
20 }
21 } else {
22 System.out.println("Failed to find the ID of the tab setting.");
23 }
24} catch (ConnectionException ce) {
25 ce.printStackTrace();
26}