Skip to main content

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:

Note

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:

CreateCustomField (line)
{
"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:

Note

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
}
}

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.

Additional services