+ Start a Discussion
Harinath Reddy 5Harinath Reddy 5 

delete status value

Hi all, I have on object like Notification in this object i have one picklist field i,e status , in this  status picklist having pending,sent,complete values.So i want to delete status = complete records based on startdate and enddate of record.can u please anyone give me some sample code.
Thanks in advance
Hello Hari,

I assuming object as Notification.
What do you mean by based on startdate and enddate?

well you can retrive records by using this simple query
List<Notification> Notifications=new List<Notification>();
Notifications=[select id,name from Notification where status='comoplete'];
Delete notifications;

You can add extra conditions in where clause.

Execute above code in execute anonymous.

Let us know if you have any issues.

Mark it as best answer if it works.