Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class UserHandler implements ITrigger{
- public UserHandler() {}
- public void bulkBefore() {}
- public void bulkAfter(){}
- public void beforeInsert(SObject so) {
- User beforeInsertUser = (User) so;
- System.debug('User Trigger ==> Before insert: User Profile Id= '+beforeInsertUser);
- if(beforeInsertUser.ProfileId == '00e80000001KWWa'){
- //Set the profile picture to public.
- System.debug('Setting UserPreferencesShowProfilePicToGuestUsers');
- beforeInsertUser.UserPreferencesShowProfilePicToGuestUsers = true;
- }
- }
- public void beforeUpdate(SObject oldSo, SObject so){}
- public void beforeDelete(SObject so){}
- public void afterInsert(SObject so){
- User afterInsertUser = (User) so;
- System.debug('User Trigger ==> After insert');
- System.debug('User = '+afterInsertUser);
- if(afterInsertUser.ProfileId == '00e80000001KWWa'){
- //Set the Profile Picture
- System.debug('Setting Profile Picture');
- ConnectApi.Photo cc = ConnectApi.UserProfiles.setPhoto('0DB80000000CdzgGAC', afterInsertUser.Id, '0698A00000014YA', null);
- }
- }
- public void afterUpdate(SObject oldSo, SObject so){}
- public void afterDelete(SObject so){}
- public void andFinally(){}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement