In the past, we usually create a custom application using Java or .NET in order to send email notification or other action regularly based on document condition in repository e.g. expired documents, document flagged for deletion and others. In this blog, we will use the built in Filenet Sweep Management and FIlenet Workflow to automate the task to send email notification for expired documents.
- This guide uses Filenet CPE 5.2.1 FP7, ICN 3.0.2 and assume the readers already:
- Familiar with Filenet Process Designer, ACCE and Content Navigator
- Configure email server for Filenet Process Engine workflow since it will leverage the Filenet workflow to send the email notification. The guide also assume that the email recipient had setup the Content Navigator preference for email address and to receive email notification for workflow task.
(refer to: https://www.ibm.com/support/knowledgecenter/en/SSCTJ4_5.2.1/com.ibm.casemgmt.installing.doc/acmin130a.htm)
- Create new or use existing document class, create new property definition and configure the document class retention
- Using ACCE, create a document class or use an existing document class e.g. Contract, that the user wants to receive notification once its retention date property (CMRetentionDate) is greater than current date and time
- Create 1 class property to mark/flag that the document is already expired that will be triggered by Sweep action, e.g. IsExpired as boolean type
- Create 1 class property to mark/flag that the workflow to send email notification already ran to prevent the user get the email expiration notification more than once, e.g. IsWorkflowStarted as boolean type
- In the document class “Retention” tab, configure the retention for the document
- The document class preparation is now completed
- Create Workflow template for email notification and workflow subscription
- Using Navigator or the stand alone application, open Process Designer
- In the Workflow Properties – Attachments tab, create new attachment
Give a name, e.g. “ExpiredDoc” and mark it as initial attachment
- Add a “Component” step and connect it to the LaunchStep
- Click on the Component step and click the icon and add CE_Operation -> setBooleanProperty. We want to get the document title from the attachment. Enter the parameters as follow:
i.destDocument : ExpiredDoc (select from the drop down list)
ii.symbolicPropName: “IsWorkflowStarted” (with the quote using <Build Expression…>)
iii.value: true (using <Build Expression…>)
- Click on the Component step and click the icon and add CE_Operation -> getStringProperty. We want to get the document title from the attachment. Enter the parameters as follow:
i.SourceDocument : ExpiredDoc
ii.SymbolicPropName: “DocumentTitle” (with the quote using <Build Expression…>)
iii.Return_value: return_doctitle (select from the drop down list)
- Click the icon and add CE_Operation -> getDateProperty. We want to get the retention date from the attachment. Enter the parameters as follow:
i.SourceDocument : ExpiredDoc
ii.SymbolicPropName: “CmRetentionDate” (with the quote using <Build Expression…>)
iii.Return_value: return_expiredDate (select from the drop down list)
- Click the icon and add CE_Operation -> sendMail. We want to send the email related to the expired document. Enter the parameters as follow:
i.From : any valid email address as the system sender e.g. “firstname.lastname@example.org”
ii.To: any valid destination email address e.g. “email@example.com” (with the quote using <Build Expression…>)
iii.Subject: “Expired Document Notification” + return_doctitle (using <Build Expression…>)
iv.Body: “Expired Document Notification \n\nDocument Title:” + return_doctitle + “\nExpiredDate:” + timetostring(return_expiredDate,”dd/mm/yyyy”)
- Click File -> Validate Workflow Collection to check if there’s any typo or configuration error
- Click File -> Filenet -> Filenet Add New, select the folder to save the new workflow template. Click Next and give a name of the workflow in the repository e.g. “Workflow Expired Document Notification”. Click Finish
- Close the Process Designer, navigate to the folder where the workflow is saved using IBM Content Navigator, right click and select Workflow -> Transfer Workflow.
- The workflow creation is now completed
- Create Workflow Subscription to automatically start the workflow whenever there is a change in the document property e.g. IsExpired property from blank to true. This change will be triggered by the Sweep that we will configure in the next step
- In ACCE, navigate to Events, Actions, Processes -> Subscriptions and click New to create new event subscription
- In field “Display Name” give a name, e.g. WF_SUB_RETENTION. Click Next
- In field “Class Type”, select “Document” and in field “Class” select the document class that will trigger the workflow in this case “Contract”. Click Next
- Check the “Create a workflow subscription" option. Click Next
- In the Triggers select “Update Event”. Click Next
- Select the “Workflow Definition” to the workflow that will be triggered when the update event occurred, in this case the “Workflow Expired Document Notification” that is created in the previous step. Click Next
- Leave empty in the “Build a Property Map” section. Click Next
- In the “Filter Expression” field enter “IsExpired=true” without the quote to instruct the system that the workflow will be triggered only when the property “IsExpired” equal to true and the workflow has not been started yet. Click Next
- Click Finish
- The creation of workflow subscription is now completed
- Navigate to Sweep Management -> Sweep Actions. Create new Sweep Action:
- Give a name e.g. “Retention Email Sweep Action” and click Next
var pnames = ['Id'];
// Implement for custom sweep policies
function onPolicySweep (sweepObject, policyObject, sweepItems)
var hcc = HandlerCallContext.getInstance();
hcc.traceDetail("sweepObject = " + sweepObject.getProperties().getIdValue(PropertyNames.ID) + "sweepItems.length = " + sweepItems.length);
// Iterate the sweepItems and change the class.
ii = 0;
for (ii = 0; ii < sweepItems.length; ii++)
// At the top of your loop, always check to make sure
// that the server is not shutting down.
// If it is, clean up and return control to the server.
if (hcc != null && hcc.isShuttingDown())
throw new EngineRuntimeException(ExceptionCode.E_BACKGROUND_TASK_TERMINATED, this.constructor.name + " is terminating prematurely because the server is shutting down");
var item = sweepItems[ii].getTarget();
var msg = "sweepItems[" + ii + "]= " + item.getProperties().getIdValue("ID");
var CEObject = com.filenet.api.core.Document (item);
// Set outcome to PROCESSED if item processed successfully.
"item processed by " + this.constructor.name);
// Set failure status on objects that fail to process.
sweepItems[ii].setOutcome(SweepItemOutcome.FAILED, "CustomSweepHandler: " +
// Implement for custom job and queue sweeps.
function onSweep (sweepObject, sweepItems)
- Since we want the sweep to run on a regular interval we use the onPolicySweep function.
- Click Finish
- The creation of custom sweep action is now completed
- Navigate to Sweep Policies -> Custom Policies. Create new Custom Sweep Policy:
- Give a name e.g. “Retention Email Sweep Policy” and click Next
- Select the “Sweep Mode” to “Normal” to normally run the Sweep
- Check the “Enable Sweep Policy” checkbox
- Click Next
- Enter the document class to be monitored in the “Target Class” field. In this case "Contract"
- In the filter expression enter “IsExpired<>true and CmRetentionDate < Now()” without the quote
- Click Next and in the “Define Custom Policy Dates” just leave the values as default and click Next
- Click Finish to complete the custom policy creation. It will not show in the list of Custom Policy screen but in the Policy Controlled Sweeps
- Click Sweep Management -> Policy Controlled Sweeps -> Document
- In the “General” tab click “New” under the “Schedule” section to set the start day, start time and duration when the sweep is allowed to run
- In the “General” tab, the important field is “Current Processed Object Count” that will count the number of objects that is expired and show that the logic to change its “IsExpired” property to true is successful
- Click on the “Subscribers” tab and you will see the new custom policy created.
- Test the configuration by examining document which retention date already past the current date (you could test by defining the document class default retention to shorter time e.g. minutes or hours)
- Navigate to Sweep Management -> Policy Controlled Sweeps -> Document. In the “General
tab, the field “Current Processed Object Count” should now greater than 0 if the configuration are correct. An email also will be sent to the user mailbox