Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<JUNC__c> lstToBeInserted = new List<JUNC__c>();
- for(XYZ__c A: [select id,f1__c,f2__c from XYZ__c where recordType.name ='A']){
- for(XYZ__c B: [select id,f1__c,f2__c from XYZ__c where recordType.name ='B']){
- if(A.f1==B.f1 && A.f2==B.f2){
- lstToBeInserted.add(new JUNC__c(A__c=A.id,B__c=B.id));
- }
- }
- }
- if(lstToBeInserted.size>0)
- insert lstToBeInserted;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement