Defining script

You must have the 'Script – Add (Configuration)' permission to define a new script.

  1. Select Configuration > Common > Scripts. The list of available scripts is displayed on the Scripts page.
    Note: You must have the ‘Script – View (Configuration)' permission to view scripts.
  2. Click New.
  3. Specify this information on the Details tab:
    Name
    A unique name of the script.
    Description
    The description for the script.
    Category
    The category to which the script must be linked. You can create a new category or select from the categories already defined.
    System
    Indicates if the script is system defined or user defined.
  4. Specify this information on the Mappings tab:
    Definition
    The mapping definition text in YAML format, to define input and output data passed to the script.
    Note: 
    • The mapping definition supports application variables, such as ‘%app_var_test%’. These application variables are replaced with the values at run-time when processing the mapping definition in the script. This process uses the existing hierarchy of macro-level overrides (SetAppVariable), Override value, Default value.
    • The mapping definition consists of data that the script uses as input and data that the script generates as output and save in SCV.
    • Input data mappings can be two types such as Read from a single SCV table or Read from SCV using a query.
      • If table is used, all records and columns of the specified table are made available to the script code as a file, with the specified file name.
      • If query is used, the records and columns returned by the specified query are made available to the script code as a file, with a file name.
    • The output data mapping is defined where predefined script outputs (results) are persisted.

    For more information, see Data mapping examples.

  5. Specify the script code as text which define the script behavior, on the Code tab.
    Note: The code supports application variables, such as '%app_var_test%'. These application variables are replaced with the values at run-time when processing the script. This process uses the existing hierarchy of macro-level overrides (SetAppVariable), Override value, Default value.
  6. Click Save. The specified information is validated, and the script configuration is saved.
    Note: These are the validation conditions:
    • If all the required fields are populated, the script configuration is validated for syntax and the requirements within the mapping definitions and code. Make sure that the Mapping Definition and the Code contain the correct syntax.
    • If validation fails, an error message is displayed to indicate the error. For example,
      Cannot save script {0}. Mapping has invalid definition. Errors: {1}.
      Where, 0 = script name, 1 = syntax error details
You can use the Scripts page to:
  • Create a duplicate of the existing script and modify the parameters as required using the Duplicate option.
  • Delete a script using the Delete option. You must have the ‘Script – Delete (Configuration)’ permission to delete a script.
  • Modify the existing scripts. You must have the ‘Script – Edit (Configuration)’ permission to modify a script.