Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. private static void processSync( String listNewJSON, String recordTypesJSON, boolean isUpdate ) {
  2.  
  3. if ( listNewJSON != null ) {
  4. List<Contact> triggerNew = (List<Contact>)JSON.deserialize( listNewJSON, List<Contact>.class );
  5. Map<String,Id> recordTypesMap = (Map<String,Id>)JSON.deserialize( recordTypesJSON, Map<String,Id>.class ); //a map, e.g., {AccountStudentRecord": "012a0000001ZMUzAAO"}
  6. List<Id> contactRecordTypeIds = new List<Id>();
  7. for ( String recordTypeReference : recordTypesMap.keySet() ) {
  8. if ( recordTypeReference.startsWith('Contact') ) {
  9. contactRecordTypeIds.add( recordTypesMap.get(recordTypeReference) );
  10. }
  11. }
  12.  
  13. List<StudentSearchHash__c> newHashes = new List<StudentSearchHash__c>();
  14. List<StudentSearchHash__c> hashesForUpdate = new List<StudentSearchHash__c>();
  15.  
  16. for ( Contact thisContact: [Complicated nested SOQL IN :triggerNew]) {
  17. //If I add here SOQL still runs recursivly, but logic executes one time. If!TriggerMonitor.ExecutedTriggerMethods.contains('updateSyncTrigger'+String.valueof(thiscontact.id)); {TriggerMonitor.ExecutedTriggerMethods.add('updateSyncTrigger'+String.valueof(thiscontact.id));
  18.  
  19. // do stuff
  20. }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement