Skip to content Skip to footer

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:

DescriptionFunction body
Display the first 4 characters in the author name in uppercasestr = str.substring(0,4); return str.toUpperCase();
Access other field’s values in the label in addition to the exiting one which invoked the functionconst alt = fieldObj.getParentLabel()
.getField(‘alternative_call_number’); const cn = fieldObj.getParentLabel()
.getField(‘call_number’);
0 Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *