Created
September 19, 2017 03:31
-
-
Save xjsender/e95e75054d22ef89004c2be37d1291aa to your computer and use it in GitHub Desktop.
User Problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List<Contact> cons = [ | |
| SELECT Id, Name FROM Contact | |
| WHERE Role_Id__c != null | |
| AND Is_Active__c = true | |
| AND Email != null | |
| ]; | |
| List<User> users = [ | |
| SELECT Id, ContactId FROM User WHERE ContactId IN :cons | |
| ]; | |
| Map<Id, User> usermap = new Map<Id, User>(); | |
| for (User usr : users) { | |
| usermap.put(usr.ContactId, usr); | |
| } | |
| for (Contact con : cons) { | |
| if (!usermap.containsKey(con.Id)) { | |
| System.debug(LoggingLevel.INFO, '*** con.Name: ' + con.Name); | |
| System.debug(LoggingLevel.INFO, '*** con.Id: ' + con.Id); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment