Question & Answer
In the Administration Console for Content Engine (ACCE) you can create a custom sweep to update a property value for document objects. A custom sweep retrieves instances of a target class and processes them with a user implemented action handler. Like a system sweep, a custom sweep operates as a background task on the server and passes retrieved instances to an action handler for processing. In both cases, a filter condition can be applied to the sweep to narrow the scope of the retrieved instances. However, a system sweep performs an action that is built into the server, whereas a custom sweep performs an action that is added to the server by an administrator. There are three basic components you need to create a custom sweep.
- In ACCE, start the New Sweep Action wizard:
- In the domain navigation pane, click the object store.
- In the object store navigation pane, right-click the Sweep Management > Sweep Actions folder and click New Sweep Action.
- Complete the wizard.
- In ACCE, Start the New Custom Job wizard:
- In the domain navigation pane, select the object store.
- In the object store navigation pane, select the Sweep Management > Job Sweeps > Custom Jobs folder.
- Click New.
- Optional: Select the Enabled property to enable the sweep to run.
- Note: Some sweep properties cannot be set in the wizard; they can only be set in the sweep object after it is created. Time slots and FilteredQueryTimeout are two such properties. If you need to change default values of properties that are not available in the wizard, disable the sweep in the wizard. You can enable the sweep later, after you change default property values in the sweep object.
- Complete the wizard.
// Implement for custom job and queue sweeps.
function onSweep (sweepObject, 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);
CEObject.getProperties().putValue("DocumentTitle","This is your new document title");
// 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: " +
* Called automatically when the handler is invoked by a custom sweep job
* or sweep policy. Specify properties required by the handler, if any.
* If you return an empty array, then all properties are fetched.
var pnames = ['Id'];
/* Implement for custom sweep policies.
* This method is not implemented because this is an example of a custom sweep job.
function onPolicySweep (sweepObject, policyObject, sweepItems)
2. Create a custom sweep action:
3. create a custom job sweep:
17 June 2018