Is it possible to assign Permission Sets Owned By Profile?

Using PermissionSet() and SOQL we can list the permission sets which are owned by profile Select Id,Name, IsOwnedByProfile, Profile.Name, Label from PermissionSet where IsOwnedByProfile=TRUE

My question is can we assign a permission set owned by a profile to different profile? For example: A custom profile named IT KingKong is listed in the Profile.Name column of the result from SOQL above. Can I assign this permission set(owned by IT KingKong profile) to another custom profile?

The interface after clicking ‘Edit Assignment’ from a User record doesn’t list any permission sets owned by profile, it only list custom permission set that we created….

Any insights/help will be greatly appreciated. Thank you!!
Source for SOQL: – By Adam Torman

Answer

It is not possible to edit PermissionSet’s that are owned by Profiles, so unfortunately, no you cannot update the ProfileId field on PermissionSet to assign it to a new profile. As per the docs

In API version 25.0 and later, every profile is associated with a permission set that stores the profile’s user, object, and field permissions, as well as setup entity access settings. Permission sets that are owned by profiles can be queried but not modified.

What you can do is write Apex code to query the respective PermissionSet objects for a profile to create a new PermissionSet (not associated with any profile) that you can you assign to one or more users, including users with the originating profile (once you assign them a lesser profile).

Attribution
Source : Link , Question Author : Raish , Answer Author : Andrew Fawcett

Leave a Comment