Employee Custom Fields

Overview

Employee Custom fields serve as an extension of the employee record on Greenshades Online. You may use this feature as needed to meet the needs of your business in unique ways.

Types of Custom Fields

The following data types are currently supported:

  • Boolean: allows true/false values only
  • Date: allows a date only
  • DateTime: allows a date with a time component
  • Decimal: any whole or fractional decimal
  • Dollar: a decimal that begins with a dollar ($) sign
  • Enum: allows only values listed in the EnumValues collection
  • Integer: any whole number
  • Percentage: a decimal that ends with a percent (%) sign
  • Text: Any text (up to 4000 characters), must match the provided regular expression (if applicable)
  • TextMultiline: Same as Text, but expected to contain line breaks or wrap on display

Scope and Naming

Your custom fields apply to a single workspace and must be uniquely named. If you have multiple workspaces you may re-use the same name once on each workspace. There is a length limit on the custom field name of 50 characters.

Regular Expression Validation

Any Text field may also specify a regular expression that will check for the validity of values saved to that field. For example, a custom field with a simple SSN expression may be specified like the following:

{
    "name": "SSN",
    "description": "Social Security Number",
    "dataType": "Text",
    "regex": {
        "description": "SSN Format",
        "pattern": "^\d{3}-\d{2}-\d{4}$"
    }
}

Enum Values

For values where there are a set number of options, the Enum data type may be used to specify those options. Values are then checked against the EnumValues collection for validity. Here is an example of a custom field using the Enum data type:

{
    "name": "Favorite Color",
    "description": "Select your favorite color. There is only one correct answer ;)"
    "dataType": "Enum",
    "enumValues": [ "Red", "Green", "Blue" ]
}

For the above field, only values of "Red", "Green" or "Blue" will be accepted.

Assigning Values to Employees

Once you've set up one or more custom fields, you may assign values for those fields via the HTTP PATCH method. This method allows you to set values for any number of fields in the same request. Using the above examples, the request body to set an employee's favorite color and SSN might look like the following:

{
    "SSN": "123-45-6789",
    "Favorite Color": "Green"
}

Values retrieved for employees follow the same format as when saving.