Setting an alert for expiring documents

Is there any way to configure sending automatic emails to users subscribed to a document when this document has reached its expiring date?

0 votes

1 answers

2214 views

ANSWER



To get these notifications you could do the following:

1) set expiration date on documents of your interest (the dublincore schema has an “expired” field of type date so you probably would want to use that one)

2) set a scheduler to launch a custom event (i.e. expiration_check) on a regular basis

3) register a service ExpirationChecker to listen for that event

4) the expiration checker service will query (NXQL) all documents that

  • have not been checked yet (have the custom “checked” property empty - you'll need this property so that you do not resend notifications on already checked documents)

  • the expiration date before today

5) loop through the not-processed, expired document list and send notifications to each user subscribed to those documents (you'll have to decide what type of subscription would have to be used for this purpose)

Another approach would be to use NotificationService (via its extension point) where you handle the launched expiration_check event on each document that subscribed to that event.

Each of these approaches will have its advantages and disadvantages depending on the context and any additional processing you want to perform as well as complexity of the task/future updates to your custom code.

Some of the questions you'd need to ask yourself would be: do users subscribe to the expiration event or you want it to be checked automatically on all documents (auto-subscribe). Do you need a list of all expired documents? Do you need any other properties/conditions to be checked. What types of documents can expire?

I hope this helps.

2 votes