Custom fields
Orders in EVA have a certain data model. The properties that make up this data model, are created and defined by our developers to serve generic customer's needs. However, we do not tailor these models to every individual customer's needs. If you want a certain field that is not included in EVA to be available on certain data models, you can use our Custom Fields functionality.
Custom fields are exactly what you think. Dream up some field that should live on some data model, and you can materialize that dream using our custom fields. Not only do we support custom fields on orders, we support it on a variety of subjects and more subjects will be added over time.
Custom field types
To see the available types, call GetCustomFieldTypes:
Take note that the ID's listed in the code sample above do not necessarily match the ID's in your environment. Always run the GetCustomFieldTypes
service on your own environment first to ensure you are using the correct TypeID.
Creation
To create a custom field, we use CreateCustomField:
{
"Name": "Test Line",
"DataType": 0,
"Order": 1,
"TypeID": 4,
"BackendID": "test_line_backendid",
"Options": {
"IsRequired": false,
"MaximumLength": 100,
"MinimumLength": 1
}
}
DataTypes
In the example above, we create a simple string input custom field. This is determined by what we input into the DataType
field. We can fetch all possible DataTypes
using GetEnumValues
:
Again, these data type key/value pairings may not be the same for your own environment. Check the correct data types using GetEnumValues
in your own environment.
All of these DataTypes require a different Options
setup in the CustomField. The following are examples for all DataTypes:
{
"Name": "Test Line",
"DataType": 0,
"Order": 1,
"TypeID": 3,
"BackendID": "test_line_backendid",
"Options": {
"IsRequired": false,
"MaximumLength": 100,
"MinimumLength": 1
}
}
{
"Name": "Test Multi-line",
"DataType": 5,
"Order": 1,
"TypeID": 3,
"BackendID": "test_multiline_backendid",
"Options": {
"IsRequired": true,
"EnumValues": {},
"MaximumLength": 100,
"MinimumLength": 1
}
}
{
"Name": "Test Number",
"DataType": 2,
"Order": 1,
"TypeID": 3,
"BackendID": "test_number-backendid",
"Options": {
"EnumValues": {},
"MaximumValue": 420,
"MinimumValue": 69
}
}
{
"Name": "Test Decimal",
"DataType": 3,
"Order": 1,
"TypeID": 3,
"BackendID": "test_decimal_backendid",
"Options": {
"EnumValues": {},
"MaximumValue": 100,
"MinimumValue": 0
}
}
{
"Name": "Test Radio buttons",
"DataType": 4,
"Order": 1,
"TypeID": 3,
"BackendID": "test_radiobuttons_backendid",
"Options": {
"EnumValues": {
"option_1": "Option 1",
"option_2": "Option 2",
"option_3": "Option 3"
},
"IsArray": false
}
}
{
"Name": "Test Checkboxes",
"DataType": 4,
"Order": 1,
"TypeID": 3,
"BackendID": "test_checkboxes_backendid",
"Options": {
"EnumValues": {
"option_1": "Option 1",
"option_2": "Option 2",
"option_3": "Option 3"
},
"IsArray": true
}
}
{
"Name": "Test Toggle",
"DataType": 1,
"Order": 1,
"TypeID": 3,
"BackendID": "test_toggle_backendid",
"Options": {
"EnumValues": {}
}
}
{
"Name": "Test Date",
"DataType": 7,
"Order": 1,
"TypeID": 3,
"BackendID": "test_date_backendid",
"Options": {
"EnumValues": {},
"MaximumDate": "2021-12-20T23:00:00.000Z",
"MinimumDate": "2021-06-20T22:00:00.000Z"
}
}
{
"Name": "Time Test",
"DataType": 6,
"Order": 1,
"TypeID": 3,
"BackendID": "time_test_backendid",
"Options": {
"EnumValues": {},
"MaximumDate": "2021-12-21T22:59:00.000Z",
"MinimumDate": "2021-06-20T22:00:00.000Z"
}
}
Default value
It is possible to specify a default value for the custom field:
{
"Options": {
"DefaultValue": "This is my default value"
}
}
Edit and view user types
Some of our customers have specific custom fields that can only be the result of an integration with an external system. For example; we have a customer that has a pretty extensive loyalty program, but that program is managed in an external system. On users, they have created a custom field IsLoyal
. This field should only be allowed to be populated by the external system.
Since our introduction of a dedicated user type for API users, we can support this. CreateCustomField
allows the following fields to be set:
{
"VisibleByUserType": 2,
"EditableByUserType": 2048
}
In this example, the field will be visible for users of type 2
(employee) but can only be edited by users of type 2048
(API).
Display Name
For front-end purposes, we allow for a DisplayName on custom fields:
{
"DisplayName": "Fancy pantsy front end name"
}
Update
In order to update a custom field, you'll need to create a new one and delete the old one.