0

I'm trying to delete the records of a particular object which have not been modified in last 30 days. For this I have my batch Apex set up but just not been able to build the query.

Query written so far:

Select id from XYZ__c where SystemModStamp >= LAST_N_DAYS:3 OR LastModifiedDate
2

I believe you have the condition in reverse, it should be something like

Select id from XYZ__c where SystemModStamp < LAST_N_DAYS:30

You might have to play with the number to include/exclude those with exactly 30 days of difference. Also feel free to add the LastModifiedDate if you want

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.