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
SteveA101SteveA101 

Rollup Summary (or maybe something else?)

Hi All,

 

I am trying to essentially create a rollup summary on a parent lookup relationship.  I have seen lots of triggers out there that look WAY too complicated for me!  Essentially what I am trying to do is select a checkbox on the Opportunity record if there is at least ONE approved Deal (Approval Status = Approved on the custom object Deal related to Opportunity).

 

Is there an easier way to accomplish this other than a rollup trigger?  Unfortunately, I cannot switch this relationship to M/D, so I'm stuck with some sort of workaround.

 

Thanks much!!

Best Answer chosen by Admin (Salesforce Developers) 
AroraAnupAroraAnup

Agreed that roll-up summary won't work in this case due to the relationship (only works in case of a Master-detail). Have you tried exploring Workflow field update?

 

From what I understand, Deal is a custom object linked to Opportunity, and on your Opportunity you want a checkbox to get checked automatically even if there is one related Deal with Approval Status = Approved. You should be able to do this using a workflow field update as the update is from Child to Parent (Deal to Opportunity). Given the fact that you want this checkbox on Opportunity to be checked even if one of the related Deal is Approved, so that Workflow Field update will work for you.

 

Create your workflow rule on Deal object with the criteria as Approval Status EQUALS Approved and evaluation criteria set to - Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

Then add a Field update. While doing so, you will get an option to select the fields either from the Deal object or from the Opportunity object. Select Opportunity and set your Checkbox to TRUE.

 

It works at my end so I am sure it should work for you too. Let me know how it goes. Good luck!

All Answers

AroraAnupAroraAnup

Agreed that roll-up summary won't work in this case due to the relationship (only works in case of a Master-detail). Have you tried exploring Workflow field update?

 

From what I understand, Deal is a custom object linked to Opportunity, and on your Opportunity you want a checkbox to get checked automatically even if there is one related Deal with Approval Status = Approved. You should be able to do this using a workflow field update as the update is from Child to Parent (Deal to Opportunity). Given the fact that you want this checkbox on Opportunity to be checked even if one of the related Deal is Approved, so that Workflow Field update will work for you.

 

Create your workflow rule on Deal object with the criteria as Approval Status EQUALS Approved and evaluation criteria set to - Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

Then add a Field update. While doing so, you will get an option to select the fields either from the Deal object or from the Opportunity object. Select Opportunity and set your Checkbox to TRUE.

 

It works at my end so I am sure it should work for you too. Let me know how it goes. Good luck!

This was selected as the best answer
SteveA101SteveA101

You are absolutely correct.  All I really care about is one or more Deals Approved.  I love it!!

 

Thanks so much!!  

SteveA101SteveA101

But strangely - I switched the relationship back to a lookup.  When I wrote the WFR and Field Update, the only object available to me was Deal?  It's almost like salesforce doesn't think a relationship exists between Opp and Deal any longer (and I confirmed it does)?

 

If I delete the lookup and re-create it, will that screw up anything?

 

Thanks!