Specifying default values for fields

In some cases, you might want to specify a default value for a field. You can specify a constant for the default value or you can use a script to calculate a default value.

Procedure

To specify the default value for a field:
  1. Start the Designer.
  2. In the Schema Repository Explorer view, expand the Record Types folder in your schema and then expand a record type.
  3. Expand the Fields node and then click on a field to open the Fields grid.
  4. In the Fields grid, click the Default Value cell of the field that you want to modify.
  5. Click the down arrow and select the type of hook to use.
    • To specify a constant value, click CONSTANT and enter a value in the Constant field.
    • To write a script, click SCRIPTS > Add Basic script or SCRIPTS > Add Perl Script and enter the code to set the default value after the lines that read (in Perl, the lines begin with the number sign (#)):
      REM Set the initial value of the field here. Example:
       REM   SetFieldValue fieldname, 12345
      
      
    • To remove an existing default value, click None.

What to do next

Compile each script to catch any syntax errors in the code before you associate it with the field. For an example of a default value script, seeField default value hook examples.