Lets say you have a parent record on an object that receives data from an external source, and every time new data comes in INSTEAD of updating an existing record is simply creates a NEW record. The Id changes (obviously) but there's an external Id that doesn't change. The old records have a status__c field thats a picklist with a text value of inactive, while the new record has the status active. That parent object has child objects that also change each time, how would i go about re-parenting those child objects to the active record.
I know i have to codemonkey something up, but i can't think of how to reparent a child record going off of parent values (ie the external Id and the status field)