You need to sign in to do that
Don't have an account?
sasham
Help on inserting records into map to an other map with all the fields
I have a map called memberUpdatmap which has some membe'srecord from member object . key is the id
Map <Id, member__c> memberUpdatmap = new Map <Id, member__c>();
I have an other map memberUpdatmap2 which has some member records and some record has same id from memberUpdatmap.
but i do not have all the fields for those records from memberUpdatmap .
I need to update all members at one time (one dml statement) .from both map. how do i get all the records from memberUpdatmap to memberUpdatmap2.
Example: Pls answer this
Map <Id, member__c> memberMap = new Map <Id, member__c>();
member__c p1 = new member__c();
p1.Id = id;
p1.put('FirstName__c', 'testaug1');
p1.put('coacher__c', '34561');
p1.put('LastName__c', 'check');
memberMap.put(p1.Id ,p1);
Map <Id, member__c> memberUpdateMap2 = new Map <Id, member__c>();
p2.Id = id;
p2.put('FirstName__c', 'testaug1');
p2.put('Employee__c', 'xyZ');
p2.put('LastName__c', 'check');
memberMap2.put(p2.Id ,p2);
p3.Id = id;
p3.put('FirstName__c', 'testaug2');
p3.put('Employee__c', 'xyZ');
p3.put('LastName__c', 'check1');
memberMap2.put(p3.Id ,p3);
but p2.id and p1.id are the same member object(id's are same) and i need to get p1 with all the fields Employee__c, coacher__c in to memberMap2
Map <Id, member__c> memberUpdatmap = new Map <Id, member__c>();
I have an other map memberUpdatmap2 which has some member records and some record has same id from memberUpdatmap.
but i do not have all the fields for those records from memberUpdatmap .
I need to update all members at one time (one dml statement) .from both map. how do i get all the records from memberUpdatmap to memberUpdatmap2.
Example: Pls answer this
Map <Id, member__c> memberMap = new Map <Id, member__c>();
member__c p1 = new member__c();
p1.Id = id;
p1.put('FirstName__c', 'testaug1');
p1.put('coacher__c', '34561');
p1.put('LastName__c', 'check');
memberMap.put(p1.Id ,p1);
Map <Id, member__c> memberUpdateMap2 = new Map <Id, member__c>();
p2.Id = id;
p2.put('FirstName__c', 'testaug1');
p2.put('Employee__c', 'xyZ');
p2.put('LastName__c', 'check');
memberMap2.put(p2.Id ,p2);
p3.Id = id;
p3.put('FirstName__c', 'testaug2');
p3.put('Employee__c', 'xyZ');
p3.put('LastName__c', 'check1');
memberMap2.put(p3.Id ,p3);
but p2.id and p1.id are the same member object(id's are same) and i need to get p1 with all the fields Employee__c, coacher__c in to memberMap2
Please check once below sample code :
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
Or i can have a map let's say memberMap3 which is going to have all the records from memberMap2 and memberMap but if any of the id exist in both map , i need to get all fields for the id whcih is from both map.Example p2 and p1 are the id so need get the feilds FirstName__c, coacher__c,LastName__c, Employee__c