I have a method which returns list of PermissionSetTabSetting records. I use following SOQL:

SELECT Id,Name,Visibility,ParentId FROM PermissionSetTabSetting WHERE (ParentId IN ('0PS5g000005r8bWGAQ'))  ORDER BY Id ASC NULLS FIRST  LIMIT 2000

When I call this method from anywhere except LWC it returns:

enter image description here I called this method from anonymous, from apex class , test class(in system mode and as System administrator).

I changed with sharing / without sharing identifier for this class. It works the same.


When I call this method from LWC i get:

enter image description here

The Id of the record is the same, but Name is changed!

I checked User ID using UserInfo.getUserId(). User is the same. Everything is the same, except Name.

What can i do?

  • are you testing this on a Winter '22 sandbox and is this running as you (presumably, an admin profile?) Sep 1, 2021 at 14:28
  • No,it is my dev org. As admin.
    – Darya
    Sep 1, 2021 at 14:40
  • This appears as a bug. Can you add the LWC code snippet too in the question? I will do a quick repro and file an investigation with concerned Salesforce team. Will update this thread as I have more inputs. Thank you Sep 13, 2021 at 17:20
  • I can confirm this bug.
    – Patlatus
    Oct 11, 2021 at 20:35

1 Answer 1


For some strange reason in LWC, Name field from PermissionSetTabSetting returns either standard object name or custom tab id, while in Classic, it returns the tab name.

Workaround here is to use Tooling API with Classic Session Id.

Create Visualforce Page 'Api'.

<apex:page controller="ApiCont" showHeader="false" sidebar="false">

Create Apex Controller ApiCont.

public with sharing class ApiCont {
    public static String SEPAR = '[|]';
    public String sid{ get{ return SEPAR + UserInfo.getSessionId() + SEPAR ;} set;}

Create Apex class ApiService.

public with sharing class ApiService{
    @testVisible static String sid;
    public static String getClassicSessionId() {
        if (sid == null) {
            sid = new PageReference(
            ).getContent().toString().substringBetween(ApiCont.SEPAR, ApiCont.SEPAR);
        return sid;

Create Apex class ToolingApi.

public with sharing class ToolingApi {
    static String restGet(String endPoint, String method, String sid) {
        Http h = new Http();
        HttpRequest hr = new HttpRequest();
        hr.setHeader('Authorization', 'Bearer ' + sid);
        HttpResponse r = h.send(hr);
        return r.getBody();
    public static String query(String query) {
        String baseURL = URL.getSalesforceBaseUrl().toExternalForm();
        return restGet( baseURL + '/services/data/v52.0/tooling/query?q='+ (query.replace(' ', '+')), 'GET', ApiService.getClassicSessionId() );

Now if you run it as Tooling Api query, it will return correct results even in LWC:

String body = ToolingApi.query('SELECT Name, ParentId, Visibility FROM PermissionSetTabSetting WHERE ParentId IN (\'' + String.join(parentIds, '\',\'') + '\')');
        System.debug(LoggingLevel.Error,  'body: ' + body);


Wherever you used to have query

SELECT Name, ParentId, Visibility
FROM PermissionSetTabSetting
WHERE ParentId IN: parentIds

use instead

Map<String, Object> dataMap = (Map<String, Object>) JSON.deserializeUntyped(body);  
(List<PermissionSetTabSetting>) JSON.deserialize(JSON.serialize(dataMap.get('records')), List<PermissionSetTabSetting>.class )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .