Part I of this subject provided theoretical information as to how “common.js” can be used to increase reusability for pre/post scripts of the Savvion BPM process template. Below are guidelines and a 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 the below snapshot. (The logical separation is required as BPM loads only “common.js” file. BPM does not allow multiple server-side javascript files to be loaded for prescript/postscript.)
Section 1:–
pre_common_workstep & post_common_workstep functions – This section will contain only two javascript functions that will be used across all the prescripts and postscripts.
Refer to the 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 the 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 the below snapshot for implementation logic for Section 3.
Note:
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”.