IBM FileNet P8, Version 5.2.1            

Setting up a change preprocessor

You can quickly set up your first change preprocessor by completing this procedure. The change preprocessor that is described in this procedure sets the Creator property to "CP Test" when a new document is created in the object store.

About this task

By completing the steps described in this procedure, you create the items identified in the following table.

Item Name Description
Document subclass CP Test Document The class where you assign the change preprocessor definition. The change preprocessor action is run on all documents that are created with this class definition.
Change preprocessor definition CP Test Definition Associates a change preprocessor action with the CP Test Document class.
Change preprocessor action CP Test Action Contains the JavaScript code that performs the action.
Object store folder CP Test Folder The folder where you can add documents when you test the change preprocessor.

Procedure

To set up a change preprocessor:

  1. Set object store security so that you have access rights to modify the Creator system property. (Full Control access does not include the required access rights by default.)
    1. In the administration console, right-click the object store where you want to create the change preprocessor and click the Security tab.
    2. Select your user name.
    3. Edit your permissions and select Modify certain system properties.
  2. Create a subclass of Document.
    1. Navigate to Object Stores > object store name > Document Class.
    2. Right-click Document Class and click New Class.
    3. Complete the Create a Class wizard by using the following values:
      • Name: CP Test Document
      • Symbolic Name: CPTestDocument
      • Description: Document subclass for testing change preprocessors.

      You can use the default values for the remaining items.

  3. Create a change preprocessor definition and a change preprocessor action.
    1. Double-click the CP Test Document class that you created and click the Change Preprocessor Definitions tab.
    2. Select Show Inherited to show inherited change preprocessor definitions.
    3. Click New and enter the following values:
      • Display Name: CP Test Definition
      • Status: Select to enable the change preprocessor definition.
      • Action: Select a change preprocessor action.
    4. Right-click the Change Preprocessor Actions folder.
    5. Click New Change Preprocessor Action and complete the Create a Change Preprocessor Action wizard by using the following values:
      • Name: CP Test Action
      • Description: This action sets the Creator property to "CP Test" when a new document is added to the system.
      • JavaScript: Select the JavaScript radio button and enter the following script where prompted:
           // Set Creator property to "CP Test" when a new document is created.
           importClass(Packages.com.filenet.api.action.Create);
           function preprocessObjectChange (sourceObj)
           {
              // Verify that the pending action is a create action.
              var actions = sourceObj.getPendingActions(); 
              for ( var i = 0; i < actions.length; i++ )
              {
                 if ( actions[i] instanceof Create ) 
                 {
                    // Set Creator property to "CP Test"
                    sourceObj.getProperties().putValue("Creator", "CP Test");
                    return true;
                 }
              }
              return false;
           }
    6. Click Add as New and then click OK.
    Important: A change preprocessor action handler that is implemented as JavaScript can fail in some WebLogic configurations. To resolve the problem, see JavaScript action handler fails (WebLogic application server).
  4. Prepare to test the change preprocessor.
    1. Navigate to Object Stores > object store name > Root Folder.
    2. Right-click Root Folder and click New Sub Folder.
    3. Enter CP Test Folder and click Create.
  5. Test your change preprocessor.
    1. Right-click CP Test Folder and click New Document.
    2. Complete the New Document wizard by using the following values. If a field or selection is not specified, use the default value.
      • Document Title: CP Test 1
      • Without Content: Select this radio button.
      • Class: Choose CP Test Document from the list.
    3. After you have specified the document class, click Create.
    4. Check the document properties and verify that the Creator property is set to CP Test.
  6. Optional: Do one or more of the following tasks:


Last updated: March 2016
cp_setup.htm

© Copyright IBM Corporation 2016.