Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trigger CommunityUserContactRemove on User (after update) {
- Profile p = [SELECT Id FROM Profile WHERE Name = 'Quatro Community Login User'];
- List<Contact> userContacts = new List<Contact>();
- for (User u : trigger.new) {
- User oldUser = Trigger.oldMap.get(u.Id);
- if (string.isBlank(u.ContactId) & u.ProfileId == p.Id){
- userContacts.add(new Contact(
- Id = oldUser.ContactId,
- Support_Community_User__c = null));
- }
- }
- update userContacts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement