function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Trying to add Opportunity ID to a List from Allocation Trigger

Hey, I have a trigger on the allocation that is trying to loop through the associated opportunities. Here is the code:


List<Opportunity> donations; for(Payment_Detail__c pd{ donations.add(pd.Donation__c); system.debug(pd.Donation__c); for(Opportunity o : donations){ // do action here

} }


Incompatible element type Id for Opportunity, although it is the field that holds the ID of the Opportunity (Donation)





In a List of Opportunity, you can not add obj of Pyment_Detail__c (for that matter any obj other than opportunity obj).


What exactly you want, I'm not getting. May be i can help you out on that






I am trying to get the opportunities associated with the Allocation. I want to loop through the opportunities and perform updates to each associated to the effect allocation.



in your code you are not instantiating your list:


List<Opportunity> donations = new List<Opportunity>();

 and refer to the relastionship name not the field name


Message Edited by tesii on 03-22-2010 01:56 PM
Message Edited by tesii on 03-22-2010 01:56 PM
Message Edited by tesii on 03-22-2010 01:58 PM