Server Automation Script Libraries

Use server automation script libraries to organize code on the server and reuse the code in automation scripts by attaching the automation script library to the desired automation scripts.

You can attach multiple automation script libraries to automation scripts but you cannot attach automation script libraries to other automation script libraries.

Libraries allow you to easily maintain the code by modifying it once (within the automation script library). The code updates will be automatically propagated to all the automation scripts that are calling the automation script library.

The typical use case scenarios for server automation script libraries include:

  1. Executing a specific block of code after an entity business status is changed. To use an automation script library to execute a block of code after a business status is changed, you need to create it first.
  2. Call the automation script library from a server script using server-side functions.

To see the list of defined server automation script libraries, go to Main Menu > Advanced > Server Automation Script Libraries.

Create Automation Script Libraries

  1. In FintechOS Studio, go to Main Menu > Advanced > Server Automation Script Libraries.
  2. Click Insert. The Add Server Automation Script Library page appears.
  3. In the Name field, enter the name of the library.
  4. In the Code field, enter the script code (write code using Server SDK functions).
  5. NOTE  
    Make sure to include in the code at least a function you wish to call from your server automation scripts.

    For example:

    var FTOSExample = FTOSExample || (function () {
            var count = 100;

            this.getCount = function () {
                    return count;

            return {
                getCount: this.getCount

    To avoid calling the wrong methods and attributes, you can use the ‘$m’ mechanism when writing the code. For more information on how to use the $m mechanism, see Code Snippets Support for JavaScript.
  6. Click Save and close. The server automation script library is saved and will be displayed in the Server Automation Script Libraries List.

Particular Automation Script Libraries

The code provided in automation script libraries with a name which follows the following naming convention statusChange_EntityName is executed automatically on entity stage transition. These libraries exist in the context of previous and current execution.


var currStatusName = getBusinessStatusName("EntityName", context.BusinessStatus);
var previousStatusName = getBusinessStatusName("EntityName ", context.PreviousBusinessStatus);

To view the state transition, use after-update event triggered scripts using the following commands:


var ent = getById("EntityName",context.Id);

svar prevBussinessStatusId = context.BeforeValues.businessStatusId;
var bussinessStatusId = ent. businessStatusId;
if (businessStatusId != prevBussinessStatusId) {
        // state transition occurred from prevBussinessStatusId to businessStatusId