Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. List<Account> uniqueIdMatchAcc = new List<Account>();
  2. if(allUniqueIDs.size()>0){
  3. uniqueIdMatchAcc = [Select id, unique__c From Account Where unique__c in :allUniqueIDs];
  4. }
  5. if(uniqueIdMatchAcc.size() > 0 ){ //if unique matches were found, feed Id's into registrationList created earlier
  6. for(Account uma : uniqueIdMatchAcc){
  7. for(registration crl : registrationList){
  8. if(uma.unique__c == crl.acc.unique__c){
  9. crl.acc.Id = uma.Id;
  10. }
  11. }
  12. }
  13. }
  14.  
  15. Map<String,Account> uniqueIdMatchAccMap = new Map<String,Account>();
  16. for(Account a: [Select unique__c From Account Where unique__c in :allUnique]){
  17. uniqueIdMatchAccMap.put(a.unique__c, a);
  18. }
  19. if(uniqueIdMatchAccMap.size() > 0 ){
  20. for(String unique : uniqueIdMatchAccMap.keySet()){
  21. for(registration rl : registrationList){
  22. if(unique == rl.acc.unique__c){
  23. rl.acc.Id = uniqueIdMatchAccMap.get(unique).Id;
  24. }
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement