• Dave Hamburg
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Trying to bulk up this method and struggling with the map concept. The Agreement__c has a related list called Facilities_Covered__c, It also has a related Modification__c and when it is created I am building a junction object between it and the Facilities (account). How can i create the group of related items?
 
public void setrelatedFC() {
			List<Modifications_Facilities_Covered__c> newFC = new List<Modifications_Facilities_Covered__c>();

			for (Modification__c newmods : newModifications.values())
				{

				Modifications_Facilities_Covered__c fc = new Modifications_Facilities_Covered__c();	

					
					list<Facilities_Covered__c> fac = [select Facility__c from Facilities_Covered__c where Agreement__c = :newmods.Agreement__c];

					for(Facilities_Covered__c f : fac )
					{

					fc.Modification__c  = newmods.id ;
					fc.Facility__c    =  f.Facility__c;

					newFC.add(fc);
					}
				}
				insert newFC;
		}

 
Trying to bulk up this method and struggling with the map concept. The Agreement__c has a related list called Facilities_Covered__c, It also has a related Modification__c and when it is created I am building a junction object between it and the Facilities (account). How can i create the group of related items?
 
public void setrelatedFC() {
			List<Modifications_Facilities_Covered__c> newFC = new List<Modifications_Facilities_Covered__c>();

			for (Modification__c newmods : newModifications.values())
				{

				Modifications_Facilities_Covered__c fc = new Modifications_Facilities_Covered__c();	

					
					list<Facilities_Covered__c> fac = [select Facility__c from Facilities_Covered__c where Agreement__c = :newmods.Agreement__c];

					for(Facilities_Covered__c f : fac )
					{

					fc.Modification__c  = newmods.id ;
					fc.Facility__c    =  f.Facility__c;

					newFC.add(fc);
					}
				}
				insert newFC;
		}