I'm trying to find out how can I pass the Attachment ParentId value that is part of a SOQL to a Set of Ids. Just testing things around.
Lets say I have the Set ready:
Set<Id> eveIds = new Set<Id>();
The newMap.keySet() is just a list of attachments coming from a SOQL (more playing around).
List<Attachment> listAtt = [SELECT Id, ParentId FROM Attachment];
Map<Id, Attachment> newMap = new Map<Id, Attachment>(listAtt);
Now, here is the SOQL:
Map<Id, Attachment> attList = new Map<Id, Attachment>([SELECT id, ParentId, Parent.Type FROM Attachment WHERE Parent.Type = 'Event' AND Id IN : newMap.keySet()]);
All this is fine, I tested this query just with a few system.debug and is fine. What I want to know is how I can pass the "ParentId" to the eveIds set that is above.
I tried something like:
for(Attachment a : attList.values())
{
eveIds.add(a.ParentId);
System.debug('This is the id of the attachemnts ' + a.Id);
System.debug('This is the parent id for the attachment ' + a.ParentId);
}
And is not passing the "ParentId" ids to the eveIds set. The System.debug are all fine, they are showing the correct ids.
This shouldn't be that hard, right? I missing something here... could anyone bring some light to this?.
I will really appreciated it.
Thanks.