Create JavaScript functions
Users with JavaScript knowledge can create custom function to update the fields value.
The functions are created in the admin area and invoked by name in the field Regex configuration.
- Enter only the function body. The function deceleration along with the opening and closing brackets will be added automatically.
- The function name must start with “get” and should be a valid JavaScript function name (no spaces, no special characters)
- Input includes 2 parameters:
- str – the initial value according to the field source (e.g. call number)
- param – the string that is populated in the Regex field
- The function should return a string


Examples:
Description | Function body |
---|---|
Display the first 4 characters in the author name in uppercase | str = str.substring(0,4); return str.toUpperCase(); |
Access other field’s values in the label in addition to the exiting one which invoked the function | const alt = fieldObj.getParentLabel() .getField(‘alternative_call_number’); const cn = fieldObj.getParentLabel() .getField(‘call_number’); |
0 Comments