Can Child Relationships be utilized to create a Rollup field with multiple conditions?

  • 1
  • Question
  • Updated 5 years ago
I have a parent object with children. The children all have an Effective Date, an "Active" checkbox and a Rate. I'd like to show the Rate from the latest child where the checkbox is True. This involves two criteria; it must be the Max WHERE Active = True. This can't be done with standard rollup fields since it can only rollup the Max, but can't also show the rate.

I attempted to accomplish this by putting a rollup on the parent which shows the Max Effective Date where the checkbox is true, and then using Child Relationships with a condition of the Effective Date of the child is equal to the rollup on the parent. I got no results however. Any ideas?
Photo of Jonathan Adlerstein

Jonathan Adlerstein

  • 528 Points 500 badge 2x thumb

Posted 5 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I think there is an easier way.  I'm going to try to show Accounts with the most recent Opportunities that had status "closed won".  I think that matches your use case... 

When you build the model for your parent object, in the fields panel there will be a "Child Relationships" section where you can select first the child object, and then the fields from that object that should be included.   



When you select Opportunities - find that entry in the field list (notice the different icon) and you can do three different things here. 
1. Choose what fields from the child object you want to retrieve. 
2. Set a Condition on this child object (for me it was "Stage = "ClosedWon")
3. In Properties order by Closed date (desc) and limit query to retrieve only one record. 



Drag the Child Field icon into your table.  This places a template component on the table which you can configure (adding mutliple fields and defining properties). 





This produces a table of accounts with their most recent closed won opportunity. 



Hope this helps. 




Photo of Jonathan Adlerstein

Jonathan Adlerstein

  • 528 Points 500 badge 2x thumb
That worked, thanks. Looks like I had already set that up by the time I got your response. Now, can I also apply a custom field render to the template field?