PermissionSetTabSetting

Represents a tab’s settings for a profile or permission set. Use PermissionSetTabSetting for manipulating tab visibility on profiles and permission sets.

Version 

Introduced in API version 37.0.

Supported SOAP API Calls 

create(), delete(), describeSObjects(), query(), retrieve(), update(), upsert()

Supported REST API Methods 

DELETE, GET, HEAD, PATCH, POST, Query

Special Access Rules 

  • As of Spring ’20 and later, only users with View Setup and Configuration permission can access this object.

Fields 

Name 

  • Type: string

  • Required: No

  • Properties: Create, Filter, Group, Sort

  • Description: The tab’s API name. For standard tabs, the name is in the form “standard-Account”. For custom tabs, it’s the developer name.

ParentId 

  • Type: reference

  • Required: No

  • Properties: Create, Filter, Group, Sort

  • Description: The ID of the permission set to which this tab setting belongs. For profile tab settings, ParentId is the ID of the permission set owned by the profile.

  • Relationship name: Parent

  • Relationship type: polymorphic

  • Refers to: MutingPermissionSet, PermissionSet

Visibility 

  • Type: picklist

  • Required: No

  • Properties: Create, Filter, Group, Restricted picklist, Sort, Update

  • Description: The default visibility setting for this tab. Valid values are:

  • Default Off

  • Default On

  • Possible values:

    • DefaultOff — Default Off

    • DefaultOn — Default On

    There’s no hidden value. Instead, a hidden tab is indicated by having no PermissionSetTabSetting row in the database.

    Note

Usage 

To hide a tab, delete the associated PermissionSetTabSetting object. ParentId and Name fields can’t be updated.

This example creates a tab setting to make the custom object tab named CustomObject__c visible for the System Administrator profile.

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}

This example updates the existing tab setting to make the Account tab available instead of visible 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    // 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}

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!