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.
Note
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-13
are all valid values, butnull
is notint?
: Likeint
but also allowsnull
int+
:[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 anull
array; but the array can be empty.
Validation Requirements
You may specify additional requirements for data properties:
Property |
Applicable Type(s) |
Details |
---|---|---|
|
numerical |
The minimum allowed value. |
|
numerical |
The maximum allowed value. |
|
strings |
The minimum string length. |
|
strings |
The maximum string length. |
|
strings |
The regular expression pattern to which the value must conform. |
|
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 |
---|---|---|
|
all |
An array of metadata strings for all fields - generally consumed by UI clients. |
|
long | decimal |
An integer specifying the number of places to persist floating point numeric values. |
|
long | decimal |
The rounding mode to be employed when rounding of the value is invoked. |
|
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
displayName
type
scope
defaultValue
min
max
minLength
maxLength
precision
roundingMode
options
regex
tag