0

I am trying to update System Permission set of Profile by apex code which is already assigned to an active profile. Is it possible to update? if yes, Then can someone please suggest how do I do that?

Here I attached a sample code:-

public List<PermissionSet> fieldPermissionsList {get;set;}
String permissionsetqueryTemp = 'Select Id,ProfileId,' + 
            string.escapeSingleQuotes(String.join(strtempList,',')) + 
          ' FROM PermissionSet where (ProfileId IN :selectedProfiles)';
if(String.isNotBlank(permissionsetqueryTemp)){ 
    fieldPermissionsList = Database.query(permissionsetqueryTemp); 
}
for(PermissionSet pSet : fieldPermissionsList) {
      Did some stuffs .... 
}
update fieldPermissionsList;
2
  • This sounds like it may be an X-Y Problem. What problem are you trying to solve that led you to this potential solution? The short answer is that there is not a "direct" path to doing what you're trying to do, but we may be able to come up with an alternative if we had more information.
    – sfdcfox
    Sep 6, 2019 at 7:11
  • Thanks for replying, like we know that we are only able to update Custom Profile system permission, so i am trying to update that custom permission through apex code. Sep 6, 2019 at 7:21

0

You must log in to answer this question.