+ Start a Discussion
koti91koti91 

clean up record ID

hi 

 

I had an object A where I  fire a triggger after update  to create an Event and task. Record Id of event and task are stored on object A.  but on some condition if i delete  Event and task,  record id fields are not deleted on object A.  i need to clean up the record id fields stored on object A when event and task are deleted. here is my code

 

for (objectA a: inactive records){

listeventIDs.add(a.event_id__c);

listtaskIds.add(a.task_id__c);

}

list<event> lstevents= [select id from event where Id in: listeventIDs and startDateTime>:now()];

list<task> lsttasks=[select id from task where Id in :listtaskIds and status='not started'];

 

if(lstevents.size()>0){

delete lstevents;

}

if(lsttasks.size()>0){

delete lsttasks;

}

 

 

how do i clean up the record id fields on object A when task and event records are deleted.

 

plz help??//