0 Replies Latest reply on Mar 29, 2016 2:51 PM by Brandon Buteau

    Unable to create and pre-populate multiple-object subform in 6.2

    Brandon Buteau Newbie

      I have read all the documentation from the user guide about forms, took the BPM Suite 6 partner class, looked at various online troubleshooting resources, etc., and am still unable to successfully create a subform of multiple objects with pre-populated data. There are no examples of this floating around that I can find. The problem is in setting up a binding variable for the parent multiple-form field that will contain a list of objects to be displayed in the subform.Here is as close as I have gotten:


      1) Create a data object (class) -- call it Foo, with attributes A1, A2, etc. -- for representing the objects to be displayed in the subform.

      2) Create another data object -- call it FooList -- for representing a list of the Foo objects to be displayed in the subform. I have tried various ways of implementing this object, but the simplest seems to be to simply have the class extend ArrayList<Foo>. The different methods don't seem to make a difference to the outcome.

      3) Create a process variable -- call it MyFoos of type FooList -- for containing a FooList. (Made sure that all necessary imports are specified in the process for java.util.ArrayList, fully-qualified-Foo, and fully-qualified-FooList.)

      4) Create a script task that constructs some Foo instances, a FooList instance, adds the Foos to the FooList, and saves the FooList in MyFoos by calling kcontext.setVariable.

      4) Create a subform -- call it FooSubform -- for displaying multiple Foo objects. The subform uses MyFoos as both the input and output IDs and Foo as the data model type (so that all A1, A2, etc. attribute fields from the Foo class are available and populated on the subform). The A1 subform field uses "MyFoos/A1" (without the quotes) as the input and output binding expressions; other attributes fields have analogous bindings. THERE ARE NO INSTRUCTIONS FOR SPECIFYING SUBFORM FIELD INPUT/OUTPUT BINDINGS, so this is a guess as to what is right. (This method at least does not produce errors at build or deploy time.)

      5) Create a user task -- call it DisplayFoos -- for invoking a user form, and assign it MyFoos as a data input (haven't even tried data output yet). The user task runs sequentially after the script task that sets a value into MyFoos.

      6) Create an associated parent form (DisplayFoos-taskform) with a multiple-subform field (intended to display multiple Foos). The multiple-subform field identifies FooSubform.form as the Default form, the Preview form, and the Table form. THERE ARE NO INSTRUCTIONS FOR SPECIFYING MULTIPLE-SUBFORM FIELD INPUT/OUTPUT bindings. I have only found two methods that are deployable without errors. If I leave the multiple-subform field input/output bindings empty, the parent form displays, but without any data showing in the field (on the label shows). If I assign "MyFoos" to the input/output bindings for the multiple-subform field, I get the following error at the time the parent form displays:


      Error showing CreateDynamicObject input javax.servlet.jsp.JspException: java.lang.ClassCastException: <fully-qualifed>.FooList cannot be cast to [Ljava.lang.Object;


      Can anyone point to an actual working example setup for multiple-subform fields or provide any guidance on how to make it actually work with pre-populated data? The available documentation is inadequate.