Hot answers tagged

1

Just loop over the keyset of the map, and use the SObject constructor to set the Id and your custom field. You need to loop over the keyset, because you can use the keys of the map to get the associated value, but not the other way around.


1

To get the value of the field Motive (probably Motive__c) from the record QueriedA, you can do: QueriedA.get('Motive__c'); that will return an object, so you will need to cast. I hope this helps.


1

Here is what I think you are looking for: Map<String, Wrapper> prs = new Map<String, Wrapper>(); for (Object obj: allData) { Wrapper pr = prs.get(obj.Primary_Stakeholder__c); if (pr == null) { // Need a new object to represent the primary stakeholder pr = new Wrapper(); pr.key = obj.Id; pr.label = obj....


Only top voted, non community-wiki answers of a minimum length are eligible