Skip to content

Configuring document expiration

Document expiration is a notification system alert which can be used to advise users about document expiration and expired documents.

Download the expiration files document_expiration_8.zip.

Execute SQL from Administration > Tools > Database query.

-- NOTIFICATION PARAMETERS
DELETE FROM OKM_CONFIG WHERE CFG_KEY LIKE '%expiration.%';
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.date.pattern','string','dd-MM-yyyy HH:mm:ss');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expiration.alert.days','string','15');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.notification.subject','string','New uploaded document with expiration');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.notification.template','text','New document uploaded<br/>${docUrl}<br/>Expiration date:${date}<br/>');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.alert.subject','string','Alert documents will expire');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.alert.template','text','Document ${docUrl} will expire at ${date}<br/>');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expired.subject','string','Documents expired');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expired.template','text','Document ${docUrl} expired at ${date}<br/>');INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expirated.reminder.days', 'string', '15');INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expirated.reminder.subject', 'string', 'Reminder alert of documents expired');INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expirated.reminder.template', 'text', 'Document ${docUrl} expired at ${date}<br/>');
Field / Property Type Description
expiration.date.pattern String Set the date pattern.
dd-MM-yyyy HH:mm:ss
expiration.notification.subject String Mail subject.
Newly uploaded document with an expiration
expiration.notification.template String Mail body.
Newly uploaded document
${docUrl}
Expiration date: ${date}
expiration.expiration.alert.days Integer Set the number of days before expiration when the expiration alert message will be sent.
15
Default document expiration sets a unique value for all documents. This is the default logic, but you can implement your own.
expiration.alert.subject String Mail subject.
Alert: documents will expire
expiration.alert.template String Mail body.
Document ${docUrl} will expire at ${date}
expiration.expired.reminder.days Integer Set the number of days for sending reminder notifications for documents that expired more than that many days ago.
15
Default document expiration sets a unique value for all documents. This is the default logic, but you can implement your own.
expiration.expired.reminder.subject String Mail subject.
Reminder alert for expired documents
expiration.expired.reminder.template String Mail body.
Document ${docUrl} expired at ${date}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN" "http://www.openkm.com/dtd/property-groups-3.10.dtd">
<property-groups>
<property-group label="Expiration" name="okg:expiration">
<input label="Expiration date" name="okp:expiration.date" type="date">
<validator type="req"/>
</input>
<select label="State" name="okp:expiration.state" type="simple">
<option label="Notify" value="notify" selected="true"/>
<option label="Valid" value="valid"/>
<option label="Expired" value="expired"/>
<validator type="req"/>
</select>
<select label="Notify" name="okp:expiration.group_notify" type="multiple" className="com.openkm.plugin.form.values.OptionSelectUserList">
<validator type="req"/>
</select>
<select label="Notify expiration alert" name="okp:expiration.group_alert" type="multiple" className="com.openkm.plugin.form.values.OptionSelectUserList">
<validator type="req"/>
</select>
<select label="Notify expirated" name="okp:expiration.group_expired" type="multiple" className="com.openkm.plugin.form.values.OptionSelectUserList">
<validator type="req"/>
</select> <select label="Notify expirated reminder alert" name="okp:expiration.group_expired_reminder" type="multiple" className="com.openkm.plugin.form.values.OptionSelectUserList"> <validator type="req"/> </select>
</property-group>
</property-groups>
  • Copy jar files into the $TOMCAT_HOME/plugins folder.
  • Restart OpenKM (this will register crontab tasks).
Task Expression Description
InitialNotification 0 */1 * * * * After a metadata group is added to the node, the “initial notification” email is sent.
The crontab task is executed every minute, looking for new nodes with a metadata group.
AlertExpirationNotification 0 30 0 * * * Sends a daily email alert for documents that will expire soon.
ExpirationNotification 0 0 0 * * * Sends a daily email alert for documents that expired today.
This crontab task should be executed before the AlertExpirationNotification task.
AlertExpiredReminderNotification 0 0 1 * * * Sends a daily email alert for documents that expired x days ago.
Report Description
ValidDocuments.jrxml Lists all valid documents.
ExpiredDocuments.jrxml Lists all expired documents.
NextExpirationDocuments.jrxml Lists documents that will expire soon.