Assign Expiry Date to Documents and Delete Automatically

Dear all,

Is it possible to assign an “expiry date” to documents in DTPO?

My goal is to automatically send documents to the trash after a certain period of time (e.g. invoices for products where the warranty has expired after two years), e.g. with a smart rule.

Does anyone have a good idea?

Thank you in advance.


I have a date field in custom metadata which can be assigned the expiry date
I use applescript to automate the assignment

Below is a sample smart rule

Not sure I’d delete the entry; maybe move it to an expired group

Screen Shot 2021-04-30 at 10.49.18

If you had only one group of items that got an “expiry date” (and all the same) then you could set up a simple Smart Rule for that group that has Date Created or Date Added > 2 years as a condition and deletes.

If you got groups/databases with mixed content (some with “expiry date”, some not) you could set a reminder to each item and let it run a script to delete the item.

If that’s too cumbersome you could expand the first suggested Smart Rule by an easy to set expiry marker—for example, a flag. So the Smart Rule deletes only items older than two years and flagged.

There are many possible ways but for all I would recommend not deletion as the action but moving the item to an archive group. Just in case you needed one of the expired items again.

Ok, I got it, thanks a lot.

I created the field “Expiry Date” in the custom metadata.

In order to follow your advice not to delete the doc automatically, I added a smart group (instead of a smart rule) which should select all documents with “Expiry Date” < today in my database. And that’s exactly my next obstacle: I cannot enter the condition “expiry date is < today”. In connection with “is” I can only select a fixed date like 31.12.2021 but not a moving date like “today”.
Any idea for a work around?

Ich benutze:

(1.000 Tage)

on performSmartRule(theRecords)
	tell application id "DNtp"
		set recCounter to 0
		set delDocs to {"
		repeat with theRecord in theRecords
			set recCounter to recCounter + 1
			set listName to ("
" & the name of theRecord)
			copy listName to end of delDocs
		end repeat
		if recCounter is greater than 0 then
			set theDialog to ("Moving " & recCounter & " expired documents to trash: " & delDocs)
			display dialog theDialog with title "Expired documents" buttons {"Cancel", "OK"} default button 1
			repeat with theRecord in theRecords
				set thisDatabase to the database of theRecord
				move record theRecord to trash group of thisDatabase
				set locking of theRecord to false
			end repeat
		end if
	end tell
end performSmartRule

Löschdatum ist in den letzten 1000 Tagen. (Oder eine noch größere Zahl)