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.


Turns out it’s very easy:

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

Source : Link , Question Author : NSjonas , Answer Author : Himanshu

Leave a Comment