Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. List<JUNC__c> lstToBeInserted = new List<JUNC__c>();
  2. for(XYZ__c A: [select id,f1__c,f2__c from XYZ__c where recordType.name ='A']){
  3. for(XYZ__c B: [select id,f1__c,f2__c from XYZ__c where recordType.name ='B']){
  4. if(A.f1==B.f1 && A.f2==B.f2){
  5. lstToBeInserted.add(new JUNC__c(A__c=A.id,B__c=B.id));
  6. }
  7. }
  8. }
  9. if(lstToBeInserted.size>0)
  10. insert lstToBeInserted;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement