Skip to main content

Script function

Execution of javascript with value insertion into other fields

Properties

User interface

This field is not displayed as a normal field, nor is the value of it saved and available to codeunits/sql-statements.

Due to its nature this field has no special editing mode.

Configuration

This field requires configuration before deployment.

image.png

Input

Is a list of fields, which values will be available as variables in the following function.
If a name contains "!", it will be loaded as a decimal.
So this configuration:

FIELD1 FIELD2! !FIELD3

Results is this code:

varlet FIELD1 = getValue("DATA_FIELD1"FIELD1");
varlet FIELD2 = getDecimal("DATA_FIELD2"FIELD2");
varlet FIELD3 = getDecimal("DATA_FIELD3"FIELD3");

Plus all those fields will trigger a re-evaluation of this field, whenever they are updates/changed.

Code (Function)

The actual javascript that modifies the data collected from the inputs.
Is pasted into a function, so should only contain lines of code.
Must have a return statement!
Sample:

return FIELD2 * FIELD3;

Output

The field to set the value of, with the return value of the final function.
The output of the function will also be the value of this field, but will not be saved, as this field is virtual and only works in the frontend.

Developer info

  • FeltTypeID: 620
  • SQL datatype: N/A
  • Class name: FieldContentFunction