User Story
As a Salesforce administrator, I want to assign the 'Service Cloud User' permission set to a specific user with the username 'admin@pathtosalesforce.com' so that the user can access the features and functionalities associated with that permission set.
Code
User u = [SELECT Id, Username FROM User WHERE Username='admin@pathtosalesforce.com'];
PermissionSet ps =[SELECT Id FROM PermissionSet WHERE Label ='Service Cloud User'];
PermissionSetAssignment psa =new PermissionSetAssignment();
psa.AssigneeId=u.Id;
psa.PermissionSetId=ps.Id;
insert psa;
Video
Video does not exists.