How can I change the status of some records when they were restored from the recycle bin?

Based on their necessity Users are adding and deleting the child records, If they accidentally deleted they are restoring it from recycle bin, by the time record restored status of the parent is changing and restored record is not showing its impact on status of the parent record.

  • Can you explain this more clearly in terms of what impact these record's status has on each other and the objects and relationship type (M:D or lookup)
    – Dave Humm
    Mar 9, 2017 at 9:16
  • This is in M:D relationship. When a child record status is open and it is deleted, in the mean time all other child records whose status changed to closed and this deleted child record restored from recycle bin and it is not updating the parent with its corresponding status.
    – Suresh
    Mar 9, 2017 at 16:30

1 Answer 1


This is where trigger frameworks and code that focuses on specific tasks come in handy.

What you need to do is create and undelete trigger.

  • Have this trigger put the undeleted records through the same code to process so that parent values are updated.

Having code that focuses on specific tasks makes this job much easier

For example, lets say that a child when inserted increments a value on the parent (via code).

When it is deleted the delete trigger takes care of updating the value by passing the records to a class that handles the calculations.

So now you need to do the same when undeleted. How you do that depends on the logic in your org

  • Goodness, how you understood the use-case is beyond me, but kudos for a great answer. Mar 8, 2017 at 18:32

Not the answer you're looking for? Browse other questions tagged .