Content Management and Capture

 View Only
  • 1.  Create Subscription Programmatically

    Posted Fri December 29, 2023 11:28 AM
    Edited by Kevin Sheng Fri December 29, 2023 11:33 AM

    I am trying to create FileNet P8 Subscription programmatically but no success. 

    Unlike the EventAction creation code below, Subscription creation does not work and I am unable to use P8 Java API to create P8 Subscription programmatically. I am using CPE JACE 5.5.8 JAR.

    EventAction eventAction = Factory.EventAction.createInstance(os, null)
    Subscription subscription = Factory.Subscription.createInstance(os, null);

    This line of code above does not compile and the method createInstance does not exist.

    Your suggestion is appreciated in advance.




    Kevin Sheng

  • 2.  RE: Create Subscription Programmatically

    Posted Mon January 01, 2024 08:22 PM

    Please try with Factory.InstanceSubscription (


  • 3.  RE: Create Subscription Programmatically

    Posted Tue January 02, 2024 05:28 AM

    Subscription is the base class for subclasses defined with specialized behavior. You can create objects for the subclasses, but you cannot create a base Subscription object.

    So you can create only subscriptions with Factory.ClassSubscription/ClassWorkflowSubscription/CmThumbnailGenerationSubscription/InstanceSubscription/InstanceWorkflowSubscription

    Gabriela Maráková

  • 4.  RE: Create Subscription Programmatically

    Posted Tue January 02, 2024 01:38 PM

    Thank you for your suggestions. AS @JIE ZHANG suggested I tried the InstanceSubscription.

    Subscription subscription = Factory.InstanceSubscription.createInstance(os, null);
    com.filenet.api.admin.ClassDefinition classDefinition = Factory.ClassDefinition.getInstance(os, new Id("{E332627C-02F2-4EF8-ABC4-3A48458AD2C2}"));
     SubscribedEventList eventList = Factory.SubscribedEvent.createList();
    Id subscribedEventId = GuidConstants.Class_CreationEvent;
    EventClassDefinition eventClassDefinition = Factory.EventClassDefinition.getInstance(os, subscribedEventId);
    SubscribedEvent subscribedEvent = Factory.SubscribedEvent.createInstance();

    Doing so works ok but not as I wanted. What i want to achieve is that the type is "Applies to all objects of this class". However the code above created  a subscription type "Applies to this instance of this class...".

    How can I specify the subscription type when creating the subscription?

    Thanks indeed.

    Kevin Sheng

  • 5.  RE: Create Subscription Programmatically

    Posted Tue January 02, 2024 02:33 PM
    ClassSubscription creates the type "Applies to all objects of this class".
    ClassSubscription subscription = Factory.ClassSubscription.createInstance(os, null);

    Kevin Sheng