Create On-demand Server Automation Scripts
- In FintechOS Studio, go to Main Menu > Advanced > Server Automation Scripts.
- Click Insert. The Add Server Automation Script form is displayed.
- In the General tab, enter a unique Name for the automation script.
- In the Description field type a description of the automation script logic. The field is optional, but we recommend you to provide a description, so that developers have a clear view on what the automation script is intended to do.
- From the Script Type drop-down, select On-Demand.
- In the Code field, enter the automation script code (using Server SDK functions). If you want to use Server Automation Script Libraries, you can do so, by calling functions defined in the library.
- Click Save and reload. This will enable the Server Automation Script Libraries and the Endpoints sections at the bottom of the page.
- Use the Server Automation Script Libraries section to select any Server Automation Script Libraries your automation script uses.
- Use the Endpoints section to define any Endpoints that call the automation script.
- Click Save and reload.
Copy
//parameter called input1 received from client <a href="https://docs.fintechos.com/ClientSDK/#Other/ebs.callActionByName.htm">callActionByName</a> function
var input1 = context.Data.input1;
//call to a method defined in server script library
var cnt = new FTOSExample().getCount();
//the custom returned object
var acc = {totalCount: cnt, test:"example1", resInput1: input1};
//returns data in UI (on callback of the callActionByName))
setData(acc);
To avoid calling the wrong methods and attributes, you can use the ‘$m’ mechanism when writing the code. For more information, see Code Snippets Support for JavaScript.
NOTE
If you want to use an automation script library (the one whose functions you appended in the Code field), after saving the automation script, go to the Edit Automation Script page and, in the List of Automation Script Libraries section, click the Insert existing button and select the desired script library by double-clicking it.
If you want to use an automation script library (the one whose functions you appended in the Code field), after saving the automation script, go to the Edit Automation Script page and, in the List of Automation Script Libraries section, click the Insert existing button and select the desired script library by double-clicking it.