Builds a version two field, which is a typed value an app contributes for use in segments, journeys and queries. Obtained from newFieldBuilder on the controller mappings. Give the field a return type, optionally the parent types it hangs off, and either an eval function or the name of a bean property to read. Call build to create and register it. Building is skipped once the app's engine has finished initialising, and an app is warned about, then blocked, as its field count passes 200 and 300.

Group: Builders


Methods

returnType(String s) · parentType(String s) · parentTypes(Object s) · parentTypes(Object s) · evalFunction(Object s) · appendQueryFunction(Object s) · evalProperty(String propertyName) · build() · build(List<Field> fields)

returnType(String s)

Returns: FieldV2Builder

Sets the type of value the field evaluates to.

ParameterDescription
sone of datetime, string, integer, boolean or double, or the name of an object type such as Profile or Lead

parentType(String s)

Returns: FieldV2Builder

Sets the single parent type this field hangs off, so the field is only offered when querying from that type.

ParameterDescription
sname of the parent type, for example Profile

parentTypes(Object s)

Returns: FieldV2Builder

Sets the parent types this field hangs off, accepting a single string, a list or an array, or null for a root level field.

ParameterDescription
sthe parent type names as a string, list or array, or null

parentTypes(Object s)

Returns: FieldV2Builder

Sets the parent types this field hangs off, given as separate arguments.

ParameterDescription
sthe parent type names

evalFunction(Object s)

Returns: FieldV2Builder

Sets the function used to evaluate the field's value for a given profile or parent object. May be a function name or an actual JavaScript function.

ParameterDescription
sthe evaluation function, or its name

appendQueryFunction(Object s)

Returns: FieldV2Builder

Sets a function that translates a comparison on this field into an Elasticsearch query, making the field searchable rather than only evaluable. The function is called with the operator and value and should return a query, for example one built with services.queryManager.createDefaultQuery.

ParameterDescription
sthe query building function, or its name

evalProperty(String propertyName)

Returns: FieldV2Builder

Reads the field's value from a bean property on the parent object instead of calling a function. Use it for values that are already exposed as a property.

ParameterDescription
propertyNamename of the property on the parent type to read

build()

Returns: void

Builds the field and adds it to this app's statically configured field list. Does nothing once the app's engine has finished initialising.

build(List<Field> fields)

Returns: void

Builds the field and adds it to the given list, which lets fields be produced dynamically rather than at load time. The field is skipped if neither an eval function nor an eval property was set, and once the list already holds more than 300 fields.

ParameterDescription
fieldsthe list the built field is added to
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.