What I am trying to do here is populate a list from a callout to Looker (BI Tool) then create a Map of Salesforce Account IDs to associated Contact Emails. To do this I created this method:
public static Map<Id, List<Contact>> lookerById() {
List<Contact> lookerList = zuoraContactSync.mergeList();
system.debug(lookerList);
Map<Id, List<Contact>> lookerByIds = new Map<Id, List<Contact>>();
for(Contact con : lookerList) {
List<Contact> contacts = lookerByIds.get(con.Email);
system.debug(lookerByIds);
lookerByIds.put(con.AccountId, contacts);
}
//status__c is ROLE
system.debug(lookerByIds.size());
system.debug(lookerByIds);
return lookerByIds;
}
return lookerByIds;
}
When I use the put on this line :
lookerByIds = put(con.AccountId, contacts);
I am returned with an incorrect method signature error.
Method does not exist or incorrect signature: void put(Id, List<Contact>) from the type ClassName
I am reasonably certain I have the right logic to do this... mostly. What am I missing?
lookerByIds.put(con.AccountId, contacts);
This should solve your issue.lookerByIds
at line #3 and haven't assigned any values. Check your business logic to make sure you are comparing a Map/List that contains your Account Ids.lookerByIds
at line #3 and didn't assign any values. I would reassess the business need and try to implement step-by-step. This way, we could get more control on the data that is being retrieved. Try going through: Apex documentation.