0

I need to figure out if values in PermissionSet for current user are changed in trigger, i'm thinking about using oldMap but i can't figure it out.

Maybe this code will explain what i'm trying to do:

    for (User u : trigger.New)
    {
        List<PermissionSetAssignment> lstOldPermSet = Trigger.oldMap.get(u.id).PermissionSetAssignments;
        List<PermissionSetAssignment> lstNewPermSet = // get PermissionSetAssignments via soql query

        if(lstOldPermSet != lstNewPermSet)
        {

// code goes in here

        }

    }

Any suggestions?

6
  • I am not sure but do you want to compare all the values and all the permissionSet attached to a user ?
    – user28829
    Commented Jul 26, 2017 at 8:44
  • Try posting entire code Commented Jul 26, 2017 at 9:21
  • PermissionsSetAssignment do not allow trigger manipulation. Are you using iTriggers? Commented Jul 26, 2017 at 9:32
  • @MerabtiIbrahim I need to run certain code when user get's or loses PermissionSetAssignment. Commented Jul 26, 2017 at 14:01
  • @SaumyaGaikwad What are iTriggers? Can you explain a bit more? Commented Jul 26, 2017 at 14:02

1 Answer 1

1

The after update trigger on User object will fire only when you will update any field of the User object.

If you will add or remove thePermissionSets, the trigger on User object will not fire.

You must log in to answer this question.

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