• MattW
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hello,

My opportunities have a look up relationship to a custom object (Target), and I would like to be able to roll up the total of Amount of the Opportunities that are associated with a given Target record, to a custom field on the custom Target option.

I have not written Apex triggers before, so a basic explanation/overview and any help you can give me would be very much appreciated.

Thanks in advance.
  • January 09, 2019
  • Like
  • 0
I have built a custom object that I want to use to hold roll up summary data on the Opportunity Amounts that are related to it. As you cannot use Opportunity records in a Master Detail realtionship with a Custom object, I have created a Junction object with a lookup relationship to the Opportunity, and a Master Detail relationship to the Custom Object where the roll ups will happen.

Having set up all the objects and relationships, the junctions and roll ups work, but the issue I am having is with automation. I have set up Processes that create a new junction record and copy over the relevant fields from the Opportunity (at either creation, or update to closed won), but am struggling to automate the completion of the Master Detail field on the junction object that will hold the roll ups.

I have tried copying a text formula that matches the name of existing Custom Object, but keep receiving ID errors that prevent the process running. How else could I populate the Master Detail field on the junction object when it is created?

Any suggestions that could help me make this work would be gratefully accepted.

PS: I know that another option is to use Flows, or a declarative rollup solution/roll up manager, but I am trying to see if I make this approach work.
  • July 20, 2018
  • Like
  • 1
I have built a custom object that I want to use to hold roll up summary data on the Opportunity Amounts that are related to it. As you cannot use Opportunity records in a Master Detail realtionship with a Custom object, I have created a Junction object with a lookup relationship to the Opportunity, and a Master Detail relationship to the Custom Object where the roll ups will happen.

Having set up all the objects and relationships, the junctions and roll ups work, but the issue I am having is with automation. I have set up Processes that create a new junction record and copy over the relevant fields from the Opportunity (at either creation, or update to closed won), but am struggling to automate the completion of the Master Detail field on the junction object that will hold the roll ups.

I have tried copying a text formula that matches the name of existing Custom Object, but keep receiving ID errors that prevent the process running. How else could I populate the Master Detail field on the junction object when it is created?

Any suggestions that could help me make this work would be gratefully accepted.

PS: I know that another option is to use Flows, or a declarative rollup solution/roll up manager, but I am trying to see if I make this approach work.
  • July 20, 2018
  • Like
  • 1