Field triggers

Field triggers come into effect when the value of a field changes, usually by user input. The field trigger can then update the contents of this field, or the content of another field.

 

Setting a trigger

To set a trigger, do the following:

  • Go to the field where you want to place the trigger.
  • Go to the tab 'Field triggers'.
  • Click 'Add field trigger' , you will automatically go to the details of the new trigger. Select the type you need and set the parameters (if any are needed).

The available field triggers are:

  • Check and/or replace
    Uses regular expressions to validate the content of the field.

  • End date/time setter
    When a class has a field for a start date and an end date, the end date should never be before the start date. In most cases the start date is entered by a user first. This trigger copies the value of the start date to the end date (when it is still empty). This trigger can be applied to fields with data type 'date', 'date/time' or 'time'.

  • First character to uppercase

    Converts the first character of the whole text (or of every word) to upper case, 'whole text' is the default. Only applies to text and memo fields.

    This helper type is deprecated. 

    Advice: write a velocity script and use StringOps.capitalize. See also: https://studio.crossmarx.nl/script_api_entity/637/stringops

    #set($value = $record.getString('field'))
    #set($newValue = $engine.getStringOps().capitalize($value))
    $record.putVoid('field', $newValue)

    Or StringOps.capitalizeAllWords:

    #set($value = $record.getString('field'))
    #set($newValue = $engine.getStringOps().capitalizeAllWords($value))
    $record.putVoid('field', $newValue)


    In case you need help in updating your helpers, contact CrossmarX by filing an issue. 



  • First initials

    Converts the whole content to upper case, and sets dots after all characters. E.g. "ab" will be converted to "A.B.".

    This helper type is deprecated.  

    Advice: write a velocity script and use StringOps.convertToInitials. See also: https://studio.crossmarx.nl/script_api_entity/637/stringops

    #set($value = $record.getString('field'))
    #set($newValue = $engine.getStringOps().convertToInitials($value))
    $record.putVoid('field', $newValue)

    In case you need help in updating your helpers, contact CrossmarX by filing an issue.



  • JAVA plugin helper
    A field trigger implemented in a JAVA class file. This option is not available yet for external developers. CrossmarX can program the calculations in the mean time. If you want to develop the calculation your self, please use Velocity.

  • Last modification setter

    Sets the last modification of field data.



  • Latitude & longitude

    Calculates latitude and longitude from address data. It works on the following data:
    - (Dutch) zip code (4 and 6).
    - zip code 6 and house number.
    - City, Street and house number.
    The zip code data overrules the city and street data.
    The trigger must be set on each of the relevant fields.

    Note: this field trigger is not triggered during an import.
    Note: this is an extra module that needs to be activated by CrossmarX.



  • Maximum number of characters

    Limits the number of characters that can be entered in a field of data type 'text', 'memo', 'email' or 'url'.

    This helper type is deprecated.  

    Advice: write a script and call substring(0, max) on the string. See: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html

    Suppose you want to restrict the value of field 'field' to 100 characters. This is how you do it.

    #set($value = $record.getString('field'))
    #set($newValue = $value.substring(0, 100))
    $record.putVoid('field', $newValue)

    In case you need help in updating your helpers, contact CrossmarX by filing an issue.



  • No spaces in text

    This validation removes all spaces from text fields. In a memo field it leaves the line breaks.

    This helper type is deprecated.

    Advice: write a script and call replace(" ", "") on the current value. See: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html

    Suppose you want to remove spaces from the value of field 'field'. This is how you do it.

    #set($value = $record.getString('field'))
    #set($newValue = $value.replace(" ", ""))
    $record.putVoid('field', $newValue)

    In case you need help in updating your helpers, contact CrossmarX by filing an issue.



  • Script

    Use this helper to implement your own trigger using a script.



  • Street and city

    Calculates the street and the city of an address from a zip and number by calling a webservice.

    Note: this field trigger is not triggered during an import.



  • String requirements

    With this helper you can set some rules a text value has to comform to. See the parameters for which rules can be set.



  • To lower case

    Converts the whole text to lower case.

    This helper type is deprecated. 

    Advice: write a script and call toLowerCase on the value. See also https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html

    #set($value = $record.getString('field'))
    #set($newValue = $value.toLowerCase())
    $record.putVoid('field', $newValue)

    In case you need help in updating your helpers, contact CrossmarX by filing an issue. 



  • To uppercase

    Converts the whole text to upper case.

    This helper type is deprecated. 

    Advice: write a script and call toUpperCase on the value. See also: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html

    #set($value = $record.getString('field'))
    #set($newValue = $value.toUpperCase())
    $record.putVoid('field', $newValue)

    In case you need help in updating your helpers, contact CrossmarX by filing an issue. 



  • Value copier from neighbour
    This trigger helper can be used to copy information from the neighbour record selected by the field this trigger is used on, to fields of the current record.

  • Velocity

    You can write your own trigger and integrate it in the Application Engine.