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
Eric BartzEric Bartz 

Formula or Apex Trigger Needed

I have a parent-child relationship between Contacts and the custom object "Staff Page". A staff page holds our staff information for a given year.

I would like to create a field on the Staff Page that counts the number of other staff pages from previous years that meet a certain criteria to determine when additional pay is awarded. I know I can do this with a roll-up summary on the Contact page to have a live look at the number of qualifying Staff Pages, but I would like for each Staff Page to show the correct number up to that point. For example a 2012 staff page would show the number 2 if that staff member qualified in 2009, 2011 and 2013.

Any thoughts or suggestions?
JeffreyStevensJeffreyStevens
Pretty sure you'll need a trigger for that.
DavidGantDavidGant
Eric - depending on the number of years you need covered by this and the number of available Rollup Summary fields left on your Contact object, a possible solution would be to create a series of Rollup Summary fields on the Contact object that would pull the totals for each year plus previous years. The formula field on the Staff Page would then use either CASE or IF statements to reference the correct Rollup based on the year listed on the Staff Page record.

Not the simplest solution, but probably easier than a trigger.
JeffreyStevensJeffreyStevens
David - Good idea.  Need to make sure the Contact to Staff Page relationship is a Master-Detail.