Defining Custom Functions (using Client Script Libraries)

To define a JavaScript function to be used across FintechOS Studio, follow these steps:

  1. On the menu, click Advanced > Client Script Libraries. The Client Script Libraries List page appears.
  2. At the upper-right corner of the page, click the Insert icon. The Add Client Script Library page appears.
  3. In the Name field, provide a unique name for the function.
  4. In the Code field, provide the actual code that will be executed.

    Code example: capitalizing a word:

    Copy
    function capitalize(word){
        return word.substr(0,1).toUpperCase() + word.substr(1); 
    }

    For usability purposes and to avoid calling the wrong methods and attributes, when creating script libraries and scripts you can use code snippets. For information on how to use code snippets, see Code Snippets Support for JavaScript.

  5. In the Definition field, provide the TypeScript definition of the code you provided in the Code field. For more information on how to write TypeScript declarations, see the TypeScript documentation.
    TypeScript Definition: capitalizing a word
    Copy
    interface ILibrary{
        capitalize(word: string): string;
    }
  6. At the upper-right corner of the page, click the Save and close icon. The new function is added to the Client Script Library and it will be displayed in the Client Script Libraries List. For information on how to use custom functions, see How to Use Custom Functions.

You can also import a Client Script Library into another one but make sure that you avoid circular reference.