BPM, Workflow, and Case

 View Only

Recipe: Use Of Invariable Constants in IBM BPM

By Saswat Patnaik posted Mon September 20, 2021 10:57 AM

  

The recipe focuses mainly on defining and use of the invariable constants within the solution created in IBM Business Process Management in:
1)Process and Services
2)Coach views
3)Client Side Human Service(CSHS)

Contents




Skill Level: Beginner

Ingredients

IBM BPM 8.5.7,IBM BAW

Step-by-step

  1. Description

    IBM Business Process Management(IBPM) doesn’t provide any specific pattern to maintain and use the invariable constants within the solution. During the development phase the constants are used to promote consistency, improve maintenance and reduce typographical errors. In the tool there are options like Exposed Process Value(EPV’s), Environment Variables and Resource Bundles ,  which are meant to store the business level constants. For an example : Gold rate or rate of interests can be used as EPV’s which can be changed as per the market values, URL’s as environment variables whose value depends on environment basis, and the UI labels can be stored as Resource Bundle.

    The recipe focuses mainly on defining and use of the invariable constants within the solution created in IBPM in the :

    1)Process and Services

    2)Coach views

    3)Client Side Human Service(CSHS).

    The constants can be declared as javascript in managed file (server file). In the file, declare a variable (refer Fig 1, variable “jsonString”) which will be creating a json string for the constants and initialize the way shown in Fig 1.

     

    Javascript-Managed-file-1

    Fig 1 : Javascript Managed file

  2. Process and Services

    In the Process and the services, a variable can be assigned value directly as shown in Fig 2 in a script.

    2_Assigning-values-to-TWVariable-in-Process-and-services-1

    Fig 2: Assigning value to a TWVariable in Process and services

     

    This can also be used directly to check conditions in the script using conditional statements(refer Fig 3) as well as in the gateways(refer Fig 4)

     

    3_Conditional-statements-in-script-1

    Fig 3: Conditional statements in script

     

    4_Conditions-in-Gateway-1

    Fig 4: Conditions in Gateway

     

  3. Coach views

    In the coach view, the .js file can be uploaded in the  “Included Scripts” section of the behavior which can be used in the event handlers as well as in the inline javascript section(refer Fig 5).

     

    5_Coach-View-1

    Fig 5: Coach view

  4. Client Side Human Service(CSHS)

    To access the constants in the Client Side Human Service(CSHS), execute the below line in the script of the process/service , and store it in a string type Parameter.(refer Fig 6).

     

    6_String-parameter-assigned-the-jsonString-1

    Fig 6: String parameter assigned the jsonString

     

    The parameter will hold value as :

    data-stored-in-Parameter-1

    Pass the string type Parameter as input to the CSHS. Declare an ANY type private variable in the CSHS and execute the below line in the server script of the CSHS(refer Fig 7).

    7_CSHS-Server-script-1

    Fig 7: CSHS Server script

    The AnyObj can now be used in the server script in assigning values to the CSHS variables or for checking conditions(refer Fig 8). It can also be used in the gateways(refer Fig 9).

     

    8_Conditional-statements-and-variable-assignment-in-CSHS-server-script-1

    Fig 8: Conditional statements and variable assignment in CSHS server script

     

    9_CSHS_Gateway-1

    Fig 9: CSHS Gateways

  5. Contributions

    Thanks to Shruti Pandey for contributing in the above solution.


#CloudPakforBusinessAutomation
#BusinessAutomationWorkflow(BAW)

Permalink