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 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:

  • 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”.

Embark On Your Automation Journey

With Nividous Quick Start Guarantee!
Nividous

Get articles from Automation Experts
in your inbox

Join > 10K People Community
SUBSCRIBE
Cross