Reusability for pre/post scripts feature of Savvion BPM using common.js: Part II

Reusability for pre/post scripts feature of Savvion BPM using common.js: Part II

Part I of this subject provided theoretical information as how “common.js” can be used increase reusability for pre/post scripts of Savvion BPM process template. Below are guidelines and detailed approach to using “common.js”.

Design/Implementation of “common.js” approach

1). Look for “common.js” file in “<%SBM_HOME %> /BizLogic” location.
2). If it is not available create a new file.
3). If it is available, edit the same file.
4). Create 3 logical sections separated with javascript comments as described in below snapshot. (The logical separation is required as BPM loads only “common.js” file. BPM does not allow multiple server side java script files to be loaded for prescript/postscript.)

Section 1:–

pre_common_workstep & post_common_workstep functions – This section will contain only two java script functions which will be used across all the prescripts and postscripts.

Refer to below snapshot for implementation logic for Section 1.

Section 2:–

Common functions used at multiple pre/post scripts – This section will contain those common functions which are required to be used for multiple pre/post scripts.

Refer to below snapshot for implementation logic for Section 2.

Section 3:–

Activity wise implementation of the prescript/postscript functions – This section will contain the actual implementation of the pre/post script functions.

Refer to below snapshot for implementation logic for Section 3.

Note:

  • The logic written in above 3 sections can be changed based on the comfort level of the process architecture.
  • For all the worksteps of the BPM Process, go to prescript and put one line of code to call the “pre_common_workstep();” function. Script language must be JavaScript.
  • For all the works of the BPM Process, go to postscript and put one line of code to call the “post_common_workstep();” function. Script language must be JavaScript.

Caution

As “common.js” is shared across all the process templates deployed on SBM Server, the merging and managing of the common.js must be done manually. This must not be kept as part of the “CommonResourcesProject”.

Leave a Reply

Your email address will not be published. Required fields are marked *