function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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
Dilip_VDilip_V
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.

THnaks.