Business requirement is to flip a few permission sets on community profile, based on certain changes in records. These changes are usually triggered as result of actions from other community users only.

So far with community user, I am able to associate new PermissionSets via Apex. But as soon as I try to remove any permission set from Community user, it gives following error:

Delete failed. First exception on row 0 with id 0PaE00000049P4VKAU; first error: FIELD_INTEGRITY_EXCEPTION, You can't revoke your own ability to Manage Profiles and Permission Sets: [Permissions]

Seems I need to give following permission: enter image description here

But on trying to enable this permission on a permissionset associated with Community User, following error comes: enter image description here

All this logic works perfect via Dev Console (i.e. Admin User). But I don't see a way to make a particular code run as admin user, I tried "without sharing" and trigger/future contexts to do the same, but it didn't succeeded.

Please advise.

2 Answers 2


Here's a very unproductive way to do this, could you try making a REST call to rest method in salesforce itself? Just wanted to see if its the Admin issue.

during the rest call you can use your admin's credentials ..

hope there is a much better way to get around but here's my rant :)

  • Thanks for response Shiv, it will not workout. As this is an AppExchange app, and from security reasons as well. Sep 24, 2014 at 15:35

One community user can add/ remove permission set to another community user. Can you check if you are given correct permission to community user or not. Like if permission on a object can not be given through custom profile to community licence user then that permission set can also not be assigned.


  • Also you will have to remove permission from permission set which can not be assigned to community user. So please uncheck "Assign Permission Sets" Sep 24, 2014 at 16:02
  • Thanks for response. Its actually same community user loosing some permissions based on his actions. So adding new permissionsets is fine, but removing permission set is not working. "Assign Permission Sets" is not applied as indicated in the original question, its erroring out for the Community User License. Sep 24, 2014 at 16:13

You must log in to answer this question.

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