+ Start a Discussion
adiazadiaz 

Help with Trigger for Roll-Up

Hi - I have a custom object called campaigns (separate from the standard object) where I want to roll up the revenue of all opportunities associated with the campaign. I've looked around for sample triggers but have not found anything close to it. Help is appreciated. Thanks!

My OwnMy Own

 

 

Create a roll up on "custom object " with opportunities revenue field. Why you want trigger for this? Use standard functionality. Let me know if this is not helpful.

adiazadiaz

It's not allowing me to create a roll-up without creating a master relationship lookup. I know that between two custom object is is easy to do. But with a standard and a custom object; it's not allowing me to create a master lookup on the opportunity. Maybe i'm explaining the logic wrong, I'll try my best to explain again:

 

 

Custom Object

 

Test Campaign


Member Count:  10

Potential Revenue: $100,000

Booked Revenue: $10,000

 

Related List:

Opportunity:       Probability      Revenue

ABC Comapny 100%           $ 10,000

XYZ Inc   75%        $ 30,000

123 Corp   75%        $ 50,000

321 LLC     50%             $10,000

 

I would like the opporunity related list revenue column to sum up and show on the Potential Revenue field in my custom object. 

 

Hope this example helps.

My OwnMy Own

 

 

try creating the master detail on "Custom Object", related to "opportunity" and then create a rollup on "opportunity" for the calculation of custom object field value.  

adiazadiaz

That would be the reverse of what i'm trying to accomplish. I need the roll-up field to be on the custom object not the opportunity. Any other ideas? I appreciate your help! :)