Assigning permission set to user in apex

  • Is it possible? Are there any limitations to consider? I have a use case where if a certain relationship is maybe, we would assign a permission set that grants access to a knowledge base data category.

  • NSjonas

    NSjonas Correct answer

    7 years ago

    Turns out it's very easy:

    PermissionSetAssignment psa = new PermissionSetAssignment
    (PermissionSetId = myPermissionSetId, AssigneeId = myAssigneeId);
    insert psa;      

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM