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
Michael French 7Michael French 7 

Linking a custom object to Opportunities and Accounts

I have custom object that needs to be linked to Opportunities, for pre-sales, and to Accounts, for post sales.

I would like to be able to add the count of this custom object into the header of the Opportunity or Account. I see that a roll-up summary field is only available if I have a Master-Detail relationship between Opportunities and my custom object.

Are there any ideas out there or has anyone done that before with success?
Best Answer chosen by Michael French 7
sandeep sankhlasandeep sankhla
Hi Michael,

So basically you have lookup relationship with Account and Opportunity.
And you want rollup some. So you can use trigger to rollup.

Let me know if above is correct and you need code for ssame to refer for this. I can help you out. 

Thanks
Sandeep

All Answers

sandeep sankhlasandeep sankhla
Hi Michael,

So basically you have lookup relationship with Account and Opportunity.
And you want rollup some. So you can use trigger to rollup.

Let me know if above is correct and you need code for ssame to refer for this. I can help you out. 

Thanks
Sandeep
This was selected as the best answer
Michael French 7Michael French 7
Thank you Sandeep. I will reach out to you if I need the code. I now have the next step to take.
Michael French 7Michael French 7
Sandeep,
I now need to know the code to sum up the custom object to the Opportunity header section. I created the Master-detail relationship between Account and my custom object. This allows me to use the standard Roll-up summary field.  But, Opportunity is a lookup within this custom object, so I need to use a trigger to count the number of records in the custom object that is in a related list to the Opportunity page.  Please let me know what you thoughts are.  Thank you.