You need to sign in to do that
Don't have an account?
Steve Berley
id field in list changing as contents added
I have a method that loops through one map and adds relevant information from a another map.
Looking at the output from the debug statements - the two ids are different, specificially one includes FF and the other includes FG. However when interrogated again they're both FG.
What's going on? How do I fix this? I have tried changing API version of the code - no luck.
for(id opp : opps.keySet()){ id dg = opps.get(opp); if (templates.containsKey(dg) ) { list<npsp__Allocation__c> thisTemplate = templates.get(dg); for (npsp__Allocation__c t : thisTemplate) { t.npsp__Opportunity__c = opp; toInsert.add(t); system.debug('added: '+toInsert[toInsert.size()-1].npsp__Opportunity__c); // << #1 } } } system.debug('------------------ '); for (npsp__Allocation__c a : toInsert ) system.debug(a.npsp__Opportunity__c); // << #2
Looking at the output from the debug statements - the two ids are different, specificially one includes FF and the other includes FG. However when interrogated again they're both FG.
What's going on? How do I fix this? I have tried changing API version of the code - no luck.
instead of above - it was solved by createing a new npsp__Allocation__c and copying values to it, then adding it.