I have one parent Object - Position and one Child Object - Candidate. Both object have Picklist field called Status. Child - Status - selected,rejected Parent - status - Open,Closed

relationship is Lookup relationship

If 10 child records created with status Value Selected, Then Parent record status value should be update with closed value

I know how to write the code for this. but I need to configuration steps to achieve this Can any one help me on this?


This is a classic use case for Declarative Lookup Rollup Summaries, which allows you to build Roll-Up Summary Fields against a Lookup relationship.

If you're not able to use DLRS, you'll have to write a moderately complex trigger against Candidate. Since you need to handle delete events to maintain an accurate rollup, Process Builder and Flow are not a candidate solution.

Your trigger would need to fire on insert, update, and delete, accumulate a set of Position objects related to the changed Candidates, and then run a bulkified helper method to query the full set of Candidates related to the Positions and update their statuses accordingly. A SOQL aggregate query would probably serve this purpose nicely, unless there's other logic you haven't discussed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.