Data Extensions
Overview
Accounts, elements, etc. can be extended with custom data properties. These entities will include a data property when accessed through the API or plugins, which contains data that was set for the entity in accordance with the configuration. For example, a vehicle element might have the following configuration:
{
"data": {
{
"name": "make",
"type": "string",
"scope": "Q,P"
},
{
"name": "model",
"type": "string",
"scope": "Q,P"
},
{
"name": "year",
"type": "int",
"scope": "Q,P"
},
{
"name": "vin",
"type": "string",
"scope": "Q,P"
}
}
}When that element is created it might then have the following contents:
{
"data": {
"make": "Toyota",
"model": "Camry",
"year": 2020,
"vin": "4T1M11AK9LU893499"
}
}Data Scopes
Each data property has an associated scope. In configuration, the scope is specified with a string such as "scope": "Q, P". These are the scope options:
QQ: The property is associated with Quick QuotesQ: The property is associated with QuotesP: The property is associated with Policies
Because quotes must have all the data required to issue a policy, a data scope of P must also have Q.
Data Types
Each property is declared with a data type. There are several built-in data types that be used, or you may define your own custom types. See the Data Extension Types topic for details.
If the type is not specified for a given data property, the default of string will be used.
Quantifiers and Arrays
Each property type may be modified by the use of a quantifier, which specifies how many of the given value the property may store. The valid quantifiers for a data extension property type are:
- (no suffix): The value is scalar and not
null(i.e. it has exactly one value) ?: The value is scalar but may benull+: The value is an array with one or more values of the given type*: The value is an array with any number of values of the given type
If you have a property with base type int, which can store an integer, the type could be declared as any of:
int:0,42, and-13are all valid values, butnullis notint?: Likeintbut also allowsnullint+:[0, 1], and[-13, 42, 103]are valid values.int*:[],[0, 1], and[-13, 42, 103]are valid values. Note that the*does not permit anullarray; but the array can be empty.
Validation Requirements
You may specify additional requirements for data properties:
| Property | Applicable Type(s) | Details |
|---|---|---|
min | numerical | The minimum allowed value. |
max | numerical | The maximum allowed value. |
minLength | strings | The minimum string length. |
maxLength | strings | The maximum string length. |
regex | strings | The regular expression pattern to which the value must conform. |
options | strings | The array of strings from which the value may be selected. |
regex provides powerful basic validation that the platform can enforce for you; for example, you may use a regex pattern to specify the acceptable shape for a string representing a legal identifier in a particular locale:
{
"data": {
"insureds_socialSecurityNumber": {
"displayName": "Social Security Number",
"type": "string",
"regex": "[0-9]{3}[-][0-9]{2}[-][0-9]{4}",
"maxLength": 11
}
}
}Other Data Properties
You may add additional properties to your data:
| Property | Applicable Type(s) | Details |
|---|---|---|
tag | all | An array of metadata strings for all fields - generally consumed by UI clients. |
precision | long | decimal | An integer specifying the number of places to persist floating point numeric values. |
roundingMode | long | decimal | The rounding mode to be employed when rounding of the value is invoked. |
defaultValue | all | The value to be used if a required field is absent upon validation. |
{
"data": {
"vechile_class_risk_factor": {
"type": "decimal",
"max": "1",
"min": "0",
"precision": 7,
"roundingMode": "halfUp",
"tag": ["tab1", "uneditable"]
}
}Comprehensive Properties List
displayNametypescopedefaultValueminmaxminLengthmaxLengthprecisionroundingModeoptionsregextag