Method for creating a check box on the ProductEditApproval work item page and subsequently handling the output from the checkbox after the work item page is submitted back to the workflow that initiated the work item.

Method for creating a check box on the ProductEditApproval work item page and subsequently handling the output from the checkbox after the work item page is submitted back to the workflow that initiated the work item.

book

Article ID: KB0090540

calendar_today

Updated On:

Products Versions
TIBCO Collaborative Information Manager -
Not Applicable -

Description

Resolution:
Description:
============
Method for creating a check box on the ProductEditApproval work item page and subsequently handling the output from the checkbox after the work item page is submitted back to the workflow that initiated the work item.

Environment:
============
TIBCO Collaborative Information Manager (CIM) 8.2.1

Cause:
======
In configuring CIM, it is sometimes useful to add extra fields to the ProductEditApproval work item page whose output can be used in a workflow step immediately after the CREATEWORKITEM step to make a decision on what to do next

Resolution:
===========
To create a check box on a work item page (in this case, for the ProductEditApproval page, although the general approach is the same for all XMLC generated web-pages in CIM):

Note: In what follows, if using Windows, change the syntax accordingly, that is use \ instead of /, %..% instead of $.. and ".bat"  instead of ".sh".

Also, downloads are available from SR_Id:1-DN9K5B)

1). First, you need the correct templates. Once you have the template zip file, unzip the template file to a directory on the CIM server.

   Locate the file under the unzipped directory:

     ./workitem/templates/ProductEditApproval.html

   The HTML page this file contains will become the generated Java class:

     com.tibco.mdm.ui.workflow.engine.workitem.templates.ProductEditApproval.class

   that will replace the existing class of the same name in ECM.ear / ECMClasses.jar

2). Having downloaded the templates, if it does not already exist, create the directory:

     $MQ_HOME/thirdparty

   Copy down the file thirdparty.zip and unzip the file to $MQ_HOME/thirdparty  This directory should now directly contain the following jar files:

     com.ibm.mq.jar       com.ibm.mqjms.jar  jsse.jar    xmlc-all-runtime.jar  xmlc-chtml.jar  xmlc-taskdef.jar
     com.ibm.mq.jmqi.jar  gnu-regexp.jar     tibjms.jar  xmlc-base.jar         xmlc.jar        xmlc-xerces.jar


3). Check that the following environment variables have been defined:

OS              : Linux / Windows / Solaris / AIX
JAVA_HOME       : Location of Java JDK installation
ANT_HOME        : $MQ_HOME/bin/buildTool    (Location of ant libraries)
ORACLE_HOME     : |
DB2_HOME        : +- One of these, depending on your database
WAS_HOME        : |
PATH            : add $MQ_HOME/bin/buildTool/bin

CUST_DEVROOT    : $MQ_HOME/build/custom/root  (this is where the html and xml files will be placed)
DEVROOT         : $MQ_HOME/build/custom/root
MQ_HOME         : CIM Install Root
MQ_LOG          : CIM LOG directory
MQ_COMMON_DIR   : CIM common directory


4). Once the variables are defined, go to the directory $MQ_HOME/build/custom and execute the customutil script:

     customutil.sh -createDirStructure    (just creates directories - ignore any errors)

     Under Linux / unix / AIX / Solaris, it may be necessary to chmod +x customutil.sh to change permissions for it to become executable.


5). Copy the ProductEditApproval.class file to the $CUST_DEVROOT/com/tibco/mdm/ui/workflow/engine/workitem/templates directory (create the path, if necessary).


6). Copy the $MQ_COMMON_DIR/standard/forms/fm26ca.xml XMLC form to $MQ_COMMON_DIR/standard/forms/fm26ca_mod.xml . Uou may eventually want to locate this elsewhere.


7). Edit the ProductEditApproval.class file.  Change:

        &ltTR id="TRASSOCPRODUCTSTABLE">
            &ltTD>
                &ltDIV class="subheaderContentsDiv">
                    &ltTABLE cellpadding="0" cellspacing="0" class="contentsTableWithGrid" id="ASSOCPRODUCTSTABLE" summary="">
                        &ltTR>
                            &ltTD class="actionToolbarTD" id="actionToolbarTD" colspan="5">
                                 &ltDIV id="actionToolbarContainer" class="actionToolbarContainer">
                                    &lta class="lnkWithImgAndText toolbarButtonDisabled"  href="#" id="ASSOCPRODUCTVIEWLINK">
                                        &ltimg src="images/view_16x16.gif">
                                        &ltspan id="ASSOClinkViewText"&gtview</span>
                                    </a>
                                    &lta class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCPRODUCTEDITLINK">
                                        &ltimg src="images/edit.gif">
                                        &ltspan id="ASSOClinkModifyText"&gtmodify</span>
                                    </a>
                                    &lta class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCREJECTIONEDITLINK">
                                        &ltimg src="images/review_16x16.gif">
                                        &ltspan id="ASSOClinkReviewText"&gtreview</span>
                                    </a>
                                    &lta class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCCOMPARELINK">
                                        &ltimg src="images/compare_records_16x16.gif">
                                        &ltspan id="ASSOClinkCompareText"&gtcompare</span>
                                    </a>
                                  </DIV>
                            </TD>
                        </TR>


  To:


        &ltTR id="TRASSOCPRODUCTSTABLE">
            &ltTD>
                &ltDIV class="subheaderContentsDiv">
                    &ltTABLE cellpadding="0" cellspacing="0" class="contentsTableWithGrid" id="ASSOCPRODUCTSTABLE" summary="">
                        &ltTR>
                            &ltTD class="actionToolbarTD" id="actionToolbarTD" colspan="5">
                                 &ltDIV id="actionToolbarContainer" class="actionToolbarContainer">
                                    &lta class="lnkWithImgAndText toolbarButtonDisabled"  href="#" id="ASSOCPRODUCTVIEWLINK">
                                        &ltimg src="images/view_16x16.gif">
                                        &ltspan id="ASSOClinkViewText"&gtview</span>
                                    </a>
                                    &lta class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCPRODUCTEDITLINK">
                                        &ltimg src="images/edit.gif">
                                        &ltspan id="ASSOClinkModifyText"&gtmodify</span>
                                    </a>
                                    &lta class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCREJECTIONEDITLINK">
                                        &ltimg src="images/review_16x16.gif">
                                        &ltspan id="ASSOClinkReviewText"&gtreview</span>
                                    </a>
                                    &lta class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCCOMPARELINK">
                                        &ltimg src="images/compare_records_16x16.gif">
                                        &ltspan id="ASSOClinkCompareText"&gtcompare</span>
                                    </a>
                                  </DIV>
                            </TD>
                            &ltTD>
                                    &ltimg src="images/my_custom_picture.gif" alt="CustomPicture" height="16" width="16" />
                                    &ltinput type="checkbox" id="CBValue" name="Label" value="MyLabel">
                            </TD>
                        </TR>

  Add an extra picture / checkbox. Note, you will probably have to change this around until you are content with the look-and-feel. You will   also need to create a custom gif image (roadworks GIF attached as my_custom_picture.gif - resize using paint.exe if need be). Place
   this file in the directory $CUST_DEVROOT/com/tibco/mdm/ui/workflow/engine/workitem/images.


8). Edit the $MQ_COMMON_DIR/standard/forms/fm26ca_mod.xml XML form.  Add a new field "CBValue"extra input or output parameters

&ltField>
  &ltID&gtCBValue</ID>
  &ltInputFrom/>
  &ltOutputTo>(//Form/Field/ID[text()='CBValue'])/following-sibling::Value</OutputTo>
  &ltOutputTo/>
  &ltValue/>
</Field>


   (Note, you are copying the CBValue field from the HTML form to the output field /Form/Field/ID[tex()='CBValue']/Value).  After this, you will need to go through the XMLC build process to change the html template into a java class :

9). Change directory to $MQ_HOME/build/custom and execute the following command:

      ant -verbose compile

   The class files are created in the $CUST_DEVROOT/classes/servletclasses/WEB-INF/com/tibco/mdm/ui/workflow/engine/workitem/templates directory


10). Having initially compiled the XMLC classes, execute the following command:

     ant -verbose deployCustom


11). You now need to copy the replacement into the ECMClasses.jar file inside the ECM.ear, replacing the original class. To do this safely, create a temporary directory under your home or login directory:

    mkdir ~/temp  (~ is shorthand for your home or login directory, and can be sued direct in Linux / Unix.  In windows, replace with your login directory path)

    Change directory to ~/temp

    Copy the deployed ECM.ear file from the server (for JBOSS, $JBOSS_HOME/server/<&ltCIM_Server>>/deploy/ECM.ear)   to   ~/temp

    jar -xvf ECM.ear ECMClasses.jar

    Copy the workflow subdirectory tree and file com/tibco/mdm/ui/workflow/engine/workitem/templates/ProductEditApproval.class
    from $MQ_HOME/build/custom/  to  ~/temp


12). Roll-up the repalcement file into ECM.ear.

    jar -uvf ECMClasses.jar com/tibco/mdm/ui/workflow/engine/workitem/templates/ProductEditApproval.class

    jar -uvf ECM.ear ECMClasses.jar


13). Put the gif image into the ECM.ear file.

    Copy the gif image from $CUST_DEVROOT/com/tibco/mdm/ui/workflow/engine/workitem/images to ~/temp/images

    jar -xvf ECM.ear EML.war

    jar -uvf EML.war images/my_custom_picture.gif

    jar -uvf ECM.ear EML.war


14). Change the workflow product edit workflow (probably standard/workflow/wfin26producteditapprovalv3.xml), adding the parameter:

    &ltParameter direction="in" eval="constant" type="string" name="Form"&gtstandard/forms/fm26ca_mod.xml</Parameter>

    to the activity:

&ltActivity Name="InternalApprovalWorkItemModify">
    &ltAction&gtCreateWorkItem</Action>
    &ltDescription lang="en"&gtCreate workitem for approval of the modification of record</Description>
    &ltExecution&gtSYNCHR</Execution>
    &ltParameter direction="in" eval="constant" type="string" name="Intent"&gtApproval</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="CUSTOM_HITHERE"&gtDEC1</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="CUSTOM_HITHERE2"&gtDEC2</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="RecordAttributeName"&gtGTIN</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="RecordAttributeName1"&gtSHORTDESC</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="RecordAttributeName2"&gtUOM</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="RecordAttributeName3"&gtDEC1</Parameter>
    &ltParameter direction="in" eval="rule" source="Record Edit Approval" type="long" name="ParticipantID"&gtworkDoc</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="FormPresentation"&gtcom.tibco.mdm.ui.workflow.engine.workitem.templates.ProductEditApproval</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="TaskType"&gtCATALOGMESSAGE</Parameter>
    &ltParameter direction="in" eval="variable" type="document" name="InDocument"&gtworkDoc</Parameter>
    &ltParameter direction="out" eval="variable" type="document" name="OutDocument"&gtwiDoc</Parameter>
    &ltParameter direction="out" eval="variable" type="boolean" name="WorkItemCreated"&gtapprovalFlag</Parameter>
    &ltParameter direction="out" eval="variable" type="boolean" name="MergedDocument"&gtworkDoc</Parameter>
    &ltParameter direction="out" name="StepID" eval="variable" type="long"&gtpl1</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="ExpiryType"&gtRELATIVE</Parameter>
    &ltParameter direction="in" eval="constant" type="string" name="ExpiryDate"&gt1:0:0:0</Parameter>
  </Activity>

    And an extra conditional transition afterwards that tests the new CBValue form value from the OutDocument (or, possibly, MergedDocument):

  &ltTransition FromActivity="InternalApprovalWorkItemModify" ToActivity="...">
    &ltDescription&gtCheck CBValue Parameter</Description>
    &ltRule>
      &ltParameter name="cBValue" type="string" eval="xpath" source="/Form/field/ID[text()='CBValue'/Value]" direction="in"&gtOutDocument</Parameter>
      &ltParameter name="result" type="boolean" direction="out"/>
      &ltCondition format="bsh"><![CDATA[result = (cBValue.equalsIgnoreCase('true'));]]></Condition>
    </Rule>
  </Transition>

   (note - not sure about the condition: you would need to inspect the OutDocument in the EventLog and see what the value of
               /Form/field/ID[text()='CBValue'/Value actually is)


15). Finally, stop, replace, and restart ECM.ear:

    cp $JBOSS_HOME/server/<&ltCIM_Server>>/deploy/ECM.ear  $JBOSS_HOME/server/<&ltCIM_Server>>/ECM.ear.old (that is, save the "old" ECM.ear for backing out if you need to)

    stop CIM (if you haven't yet)

    cp -f ~/temp/ECM.ear $JBOSS_HOME/server/<&ltCIM_Server>>/deploy/ECM.ear

    restart CIM.


Your Product Modify process should now, via a user's Inbox, provide an extra checkbox for the user that will be examined in the
  /wfin26producteditapprovalv3.xml workflow.  By changing the form line you added from:

                                    &ltinput type="checkbox" id="CBValue" name="Label" value="MyLabel">
To
                                    &ltinput type="radio" id="CBValue" name="Label" value="MyLabel">

You can change the checkbox to a radio button, while adding "checked", as in

                                    &ltinput type="checkbox" id="CBValue" name="Label" value="MyLabel" checked="checked">

The checkbox / button appears pre-selected and has to be clicked to be unselected.

Issue/Introduction

Method for creating a check box on the ProductEditApproval work item page and subsequently handling the output from the checkbox after the work item page is submitted back to the workflow that initiated the work item.