The context of this question is that I am developing a managed package. In the managed package there is functionality which should only be made available to system administrators. To check whether a user is a system administrator I have an apex method which gets their profile Id using UserInfo.getProfileId() and compares it to the system admin profile Id.

To get the system admin profile Id I have the following SOQL query -

SELECT Id, Name FROM Profile WHERE Name = 'System Administrator'

which works great.....except when the language of the user changes to anything other than English.

When the language changes no results will be returned because it is searching for the profile names assuming the input was in the users language. For example if my user language is Korean I need to perform the query as follows -

SELECT Id, Name FROM Profile WHERE Name = '시스템 관리자'

which will return the same result as the first query.

What is the best approach to handling this kind of situation? I am new to I18N in Salesforce so have no clue how to approach this. Should I use labels somehow? Is there a complete alternate approach to retrieving the profile?

  • I do not believe Profile names are localizable. Have you found otherwise?
    – Phil W
    Sep 30, 2021 at 21:19
  • What's the context of where you need to do this query? You can look at this question/answer for that scenario/ideas. Oct 1, 2021 at 12:03
  • Context updated in question.
    – Tom Ansley
    Oct 1, 2021 at 13:21
  • If this is functionality that should only be available to a sub-set of users I suggest looking into custom permissions. Oct 1, 2021 at 15:05

3 Answers 3


Since profiles and permission sets have a 1-1 relationship, you can query the permission set without relying on the profile name. This is a more accurate way to check since multiple profiles can have PermissionsModifyAllData.

 Boolean hasModifyAll = [SELECT PermissionsModifyAllData FROM PermissionSet WHERE ProfileId = :UserInfo.getProfileId()].PermissionsModifyAllData;

It's also recommended to "cache" the value since the user never changes in a transaction to avoid additional queries.

public static Boolean MODIFY_ALL_USER {
    public get {
        if(MODIFY_ALL_USER == null) {
            MODIFY_ALL_USER = hasModifyAll();
        return MODIFY_ALL_USER;
    private set;

private static Boolean hasModifyAll() {
    return [SELECT PermissionsModifyAllData FROM Profile WHERE Id = :UserInfo.getProfileId()]?.PermissionsModifyAllData == true;
  • and what if you have multiple profiles with modify all data?
    – Damecek
    Oct 1, 2021 at 7:40
  • I agree that this answer might not solve the question as stated above but in fact it does solve my problem as allowing any profile with modify all data would be acceptable. I have not marked this as the correct answer but have moded it up as it was useful.
    – Tom Ansley
    Oct 1, 2021 at 13:29
  • @Damecek I believe this answers your question. Sorry for the confusion, I've edited the answer. Oct 1, 2021 at 17:30

In Salesforce, Standard Profile's name property is not allowed to renamed into another language I think. If you tried to edit the name it's not allowed to change, it's just shows that name in read onlymode.

So If you need your profiles in your local language (like korean, chinese etc.) Please create a custom profile (by cloning from Std. profile) and you can able to mention that profile name in your language. But it's not a good approach, because some org can have more then 5 language users, So it's increase the profile counts if everyone can make the Custom profile with his own language.

So Please kept the profile in English language(common) and create a custom label with that profile name and store the profile id in that custom label value. After you can able to show the custom label into your local language like this and use that custom label's value into your query or where it's need in development.

Please let me know if it helps.


As Mohan mentioned the best practice is to create Custom Profiles, because their names are not translated.

If you are stuck with using 'System Admin' then I would suggest introducing CustomLabel with values for different languages

  • That makes sense. The problem is this is for a managed package where other users will be installing this package into their orgs. I can hardly expect users to always create a separate System Administrator profile just for this app.
    – Tom Ansley
    Oct 1, 2021 at 14:16
  • that's why using Permission Sets in my opinion is better. You can package them and you can assign them to users in Tests. You can create something like 'My_Package_Admin' and use it instead of System Admin
    – ytiq
    Oct 4, 2021 at 5:27

You must log in to answer this question.

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