Skip to main content

Introduction to Custom Functions


For some personalized data processing requirments, you can customize functions to handle them quickly.

  • The function supports the language, Javascript.

  • The function can only return one value.

  • Return the value of a function via return.

  • Custom functions are updated asynchronously and run in a separate thread without blocking the UI.

  • Function will be actively terminated if no result is returned within 1 second.

  • Custom functions can be used only when assigning default values to fields. It is not available in the calculation node of the workflow (available in the the code block node).

Example

The following example describes how to receive field values in a function, how to output function results, etc.

Scenario:

1. Entrance to Custom Function

When setting the default value for the birth date field, select [Function Calculation], and edit the custom function.

2. Edit the code for the custom function

How to receive field values

Define variables in the function header to receive the field value, for the part after the equal sign, directly click the field on the left.

Return the function result via return

  • Write the returned content directly after [return].

  • Or after receiving the calculation result via a variable, return the variable.

3. Save the function

4. Test

5. Get URL query parameter function

When using a custom function, you can use SYSTEM_URL_PARAMS.paramName to get the URL query parameters; paramName is the name of the variable parameter.

It is available only in web browsers, not in apps.

As shown below, get the value of the corpid parameter in the URL.

Example:

Current URL: https://www.mingdao.com/public/form/93cdbb7e20c843478cf988d2d428d86b?corpid=aa163&secledId=123456

Configure custom function default values for the two text fields:

Code in Custom FunctionDefault Value Obtained
return SYSTEM_URL_PARAMS.corpidaa163
return SYSTEM_URL_PARAMS.secledId123456

You can modify the values after corpid and secledId in the URL, and refresh the page, it will get the new values.

In the URL of the view, if there is a parameter, you can also get it when you create a new record.


Have questions about this article? Send us feedback