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:
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.
But!!!
When I call this method from LWC i get:
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?
Best Answer
For some strange reason in LWC,
Name
field fromPermissionSetTabSetting
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'.
Create Apex Controller
ApiCont
.Create Apex class
ApiService
.Create Apex class
ToolingApi
.Now if you run it as Tooling Api query, it will return correct results even in LWC:
Wherever you used to have query
use instead