Skip to main content

FieldLogs

Creating Custom Functions

Custom Functions are user-defined JavaScript functions that are executed on the backend. These functions can be used to call an external system to retrieve/validate data.

You must have the appropriate access rights to use Custom Functions. You must be part of the User Set associated with a Custom Function to view it.

You can build the required business logic using Custom Functions. These Custom Functions can accept arguments and return values.

Creating a Custom Function

A Custom Function must be defined before it can be used.

To create a Custom Function:

  1. From the main menu, go to Enterprise > Data > Custom Functions.

    CF1.png
  2. Click Create a new Function.

    CF2.png

    The Create a new Function dialog appears.

    CF3.png
  3. Enter the Function Name.

  4. Enter the Function Label.

  5. Enter the Function Namespace. The Namespace organizes the Custom Functions.

  6. Enter the required Function Code.

  7. [Optional] Click addnewparaminline.png to add parameters.

    CF-AddParam.png

    You can add a label, description, and a default value for the parameter.

    AddParam2.png
  8. [Optional] Customize the Return Type.

    CF-CustReturn.png
  9. [Optional] Enter the Function Description.

  10. Click Addusersetinline.png to associate User Sets with this Custom Function.

    AddUserSets.png
    AddUserSets2.png

    Note

    Only users who are part of the added User Sets can access this Custom Function.

  11. Click Save.

    CF4.png

    The Custom Function is created. Note that the Custom Function is created in the specified Namespace.

    CF5.png

This Custom Function can then be used in scripts as a FieldLogs keyword. The FieldLogs keyword prefix Flkw: is followed by the Function Name. The example below shows the Custom Function getptcvalues used in a script.

CF6.png