Defines a single configurable field on an entity such as a lead, an automation trigger, or a metric - name, title, type, options and validation, plus the HTML needed to render it as a form control. An ExtraField can be built programmatically with the fluent setter methods, or parsed from a compact, semicolon-separated configuration string such as "text=Category;required=true;options(a,b,c)" via the parse method. It also renders itself to HTML for use in admin and website forms, either directly or through the nested ExtraFieldRenderer builder. Subclasses such as GroupExtraField, OrgExtraField and ProfileIdentifierExtraField specialise the rendering and options for particular value types.

Group: Custom Fields

Implements: Serializable


Properties

PropertyReturnsDescription
aggregatebooleanWhether this field's values should be aggregated, for example when used to define a metric.
expressionStringAn expression associated with this field, used when the field represents a computed or filterable value.
fileUploadbooleanWhether this field renders as a file upload control rather than a text input.
groupGroupThe group this field is associated with, when the field was parsed for a specific group.
helpStringHelp text to display alongside this field's form control.
hiddenbooleanWhether this field is hidden from the form it is otherwise rendered on.
htmlStringRenders this field as an HTML form control, using its current value.
indexedbooleanWhether this field's value should be included in the search index.
kcodeSelectionbooleanWhether this field's options are selected from kcode values rather than plain strings.
nameStringThe name of this field, used as its key in configuration strings and as the form control's name attribute.
operatorsList<String>The comparison operators available for this field when it is used in a filter, for example the numeric operators for a numeric field.
optionsList<String>The fixed list of selectable option values for this field, if it has been given one directly rather than an options supplier.
orderingIntegerThe relative display order of this field amongst a set of fields; lower values sort first.
requiredbooleanWhether a value must be given for this field.
rowsIntegerThe number of rows to render this field as a textarea with. When null or less than 1 the field renders as a plain text input instead.
textStringThe placeholder or prompt text shown for this field, for example in a select's "please select" option or an input's placeholder attribute. Falls back to the field's name if never set.
titleStringThe display label for this field.
typeStringThe data type of this field's value, for example "string" or "integer".
valueStringThe current value of this field, used to pre-populate its form control when rendered.

Methods

options(String ss) · optionsFn(Supplier<List<String>> optionsFn) · optionsFn(ScriptObjectMirror optionsJsFn) · boolOptions() · websiteOptions() · pointsBucketOptions() · getName() · getText() · getTitle() · getHelp() · setHelp(String help) · getOptions() · getGroup() · isRequired() · isAggregate() · isHidden() · isFileUpload() · isKcodeSelection() · getValue() · setValue(String value) · getExpression() · setExpression(String expression) · getType() · setType(String type) · getOperators() · setOperators(List<String> operators) · getOrdering() · setOrdering(Integer ordering) · getRows() · setRows(Integer rows) · getHtml() · html(Object value) · html(Object oValue, String extraClasses, String namePrefix) · html(Object oValue, String extraClasses, String namePrefix, Relational owner) · render() · adminHtml(NvPair pair) · setExtraField(Object object, String value) · isIndexed() · setName(String name) · setRequired(boolean required) · setAggregate(boolean aggregate) · setHidden(boolean h) · setIndexed(boolean indexed) · setFileUpload(boolean fileUpload) · setKcodeSelection(boolean kcodeSelection) · setText(String text) · setTitle(String title) · setOptions(List<String> options) · setGroup(Group group) · title(String s) · text(String s) · help(String s) · integerType() · type(String s) · required(boolean b) · rows(int s) · fileUpload(boolean b) · kcodeSelection(boolean b) · lookupOptions() · format()

options(String ss)

Returns: ExtraField

Sets a fixed list of selectable option values for this field, replacing any previous options.

ParameterDescription
ssthe selectable option values

optionsFn(Supplier<List<String>> optionsFn)

Returns: ExtraField

Sets a supplier that lazily computes the field's selectable options each time they are looked up, instead of a fixed list.

ParameterDescription
optionsFnthe supplier of option values

optionsFn(ScriptObjectMirror optionsJsFn)

Returns: ExtraField

Sets a Nashorn JavaScript function that lazily computes the field's selectable options each time they are looked up. The function is called with this field as its argument and must return a list; any non-null element is converted to a string.

ParameterDescription
optionsJsFnthe JavaScript function that returns the option values

boolOptions()

Returns: ExtraField

Sets this field's selectable options to "true" and "false", for a boolean-style choice.

websiteOptions()

Returns: ExtraField

Sets this field's selectable options to the names of the current tenant organisation's websites, excluding any website that is configured as a redirect to another website.

pointsBucketOptions()

Returns: ExtraField

Sets this field's options supplier to the names of the current context's points buckets, looked up lazily from the points manager each time the options are requested.

getName()

Returns: String

The name of this field, used as its key in configuration strings and as the form control's name attribute.

getText()

Returns: String

The placeholder or prompt text shown for this field, for example in a select's "please select" option or an input's placeholder attribute. Falls back to the field's name if never set.

getTitle()

Returns: String

The display label for this field.

getHelp()

Returns: String

Help text to display alongside this field's form control.

setHelp(String help)

Returns: void

Sets the help text to display alongside this field's form control.

ParameterDescription
helpthe help text

getOptions()

Returns: List<String>

The fixed list of selectable option values for this field, if it has been given one directly rather than an options supplier.

getGroup()

Returns: Group

The group this field is associated with, when the field was parsed for a specific group.

isRequired()

Returns: boolean

Whether a value must be given for this field.

isAggregate()

Returns: boolean

Whether this field's values should be aggregated, for example when used to define a metric.

isHidden()

Returns: boolean

Whether this field is hidden from the form it is otherwise rendered on.

isFileUpload()

Returns: boolean

Whether this field renders as a file upload control rather than a text input.

isKcodeSelection()

Returns: boolean

Whether this field's options are selected from kcode values rather than plain strings.

getValue()

Returns: String

The current value of this field, used to pre-populate its form control when rendered.

setValue(String value)

Returns: void

Sets the current value of this field, used to pre-populate its form control when rendered.

ParameterDescription
valuethe field's current value

getExpression()

Returns: String

An expression associated with this field, used when the field represents a computed or filterable value.

setExpression(String expression)

Returns: void

Sets the expression associated with this field.

ParameterDescription
expressionthe field's expression

getType()

Returns: String

The data type of this field's value, for example "string" or "integer".

setType(String type)

Returns: void

Sets the data type of this field's value, for example "string" or "integer".

ParameterDescription
typethe field's type

getOperators()

Returns: List<String>

The comparison operators available for this field when it is used in a filter, for example the numeric operators for a numeric field.

setOperators(List<String> operators)

Returns: void

Sets the comparison operators available for this field when it is used in a filter.

ParameterDescription
operatorsthe field's available operators

getOrdering()

Returns: Integer

The relative display order of this field amongst a set of fields; lower values sort first.

setOrdering(Integer ordering)

Returns: void

Sets the relative display order of this field amongst a set of fields; lower values sort first.

ParameterDescription
orderingthe field's ordering

getRows()

Returns: Integer

The number of rows to render this field as a textarea with. When null or less than 1 the field renders as a plain text input instead.

setRows(Integer rows)

Returns: void

Sets the number of rows to render this field as a textarea with.

ParameterDescription
rowsthe number of textarea rows, or null for a plain text input

getHtml()

Returns: String

Renders this field as an HTML form control, using its current value.

html(Object value)

Returns: String

Renders this field as an HTML form control for the given value, converting the value to a display string first.

ParameterDescription
valuethe value to render into the form control

html(Object oValue, String extraClasses, String namePrefix)

Returns: String

Renders this field as an HTML form control for the given value, with extra CSS classes and a name prefix applied to the control's name attribute.

ParameterDescription
oValuethe value to render into the form control
extraClassesadditional CSS classes to add to the form control, may be null
namePrefixa prefix to prepend to the form control's name attribute, may be null

html(Object oValue, String extraClasses, String namePrefix, Relational owner)

Returns: String

Renders this field as an HTML form control for the given value and owning entity, with extra CSS classes and a name prefix applied to the control's name attribute.

ParameterDescription
oValuethe value to render into the form control
extraClassesadditional CSS classes to add to the form control, may be null
namePrefixa prefix to prepend to the form control's name attribute, may be null
ownerthe entity that owns this field's value, made available to the rendering template, may be null

render()

Returns: ExtraFieldRenderer

Starts a fluent ExtraFieldRenderer to configure and render this field's HTML form control with more options than the html(...) overloads expose directly.

adminHtml(NvPair pair)

Returns: String

Renders a name/value pair for read-only admin display. For a file upload field this returns a download link built from the stored value; for any other field it returns the raw property value unchanged.

ParameterDescription
pairthe name/value pair to render

setExtraField(Object object, String value)

Returns: boolean

Unimplemented stub for applying this field's value to a target object; currently always returns false and has no effect.

ParameterDescription
objectthe object the value would be applied to
valuethe value that would be applied

isIndexed()

Returns: boolean

Whether this field's value should be included in the search index.

setName(String name)

Returns: void

Sets the name of this field, used as its key in configuration strings and as the form control's name attribute.

ParameterDescription
namethe field's name

setRequired(boolean required)

Returns: void

Sets whether a value must be given for this field.

ParameterDescription
requiredtrue if the field is required

setAggregate(boolean aggregate)

Returns: void

Sets whether this field's values should be aggregated, for example when used to define a metric.

ParameterDescription
aggregatetrue to aggregate the field's values

setHidden(boolean h)

Returns: void

Sets whether this field is hidden from the form it is otherwise rendered on.

ParameterDescription
htrue to hide the field

setIndexed(boolean indexed)

Returns: void

Sets whether this field's value should be included in the search index.

ParameterDescription
indexedtrue to index the field

setFileUpload(boolean fileUpload)

Returns: void

Sets whether this field renders as a file upload control rather than a text input.

ParameterDescription
fileUploadtrue to render as a file upload

setKcodeSelection(boolean kcodeSelection)

Returns: void

Sets whether this field's options are selected from kcode values rather than plain strings.

ParameterDescription
kcodeSelectiontrue to use kcode selection

setText(String text)

Returns: void

Sets the placeholder or prompt text shown for this field.

ParameterDescription
textthe field's text

setTitle(String title)

Returns: void

Sets the display label for this field.

ParameterDescription
titlethe field's title

setOptions(List<String> options)

Returns: void

Sets a fixed list of selectable option values for this field, replacing any previous options.

ParameterDescription
optionsthe selectable option values

setGroup(Group group)

Returns: void

Sets the group this field is associated with.

ParameterDescription
groupthe associated group

title(String s)

Returns: ExtraField

Sets the display label for this field.

ParameterDescription
sthe field's title

text(String s)

Returns: ExtraField

Sets the placeholder or prompt text shown for this field.

ParameterDescription
sthe field's text

help(String s)

Returns: ExtraField

Sets the help text to display alongside this field's form control.

ParameterDescription
sthe field's help text

integerType()

Returns: ExtraField

Sets this field's type to "integer".

type(String s)

Returns: ExtraField

Sets the data type of this field's value, for example "string" or "integer".

ParameterDescription
sthe field's type

required(boolean b)

Returns: ExtraField

Sets whether a value must be given for this field.

ParameterDescription
btrue if the field is required

rows(int s)

Returns: ExtraField

Sets the number of rows to render this field as a textarea with.

ParameterDescription
sthe number of textarea rows

fileUpload(boolean b)

Returns: ExtraField

Sets whether this field renders as a file upload control rather than a text input.

ParameterDescription
btrue to render as a file upload

kcodeSelection(boolean b)

Returns: ExtraField

Sets whether this field's options are selected from kcode values rather than plain strings.

ParameterDescription
btrue to use kcode selection

lookupOptions()

Returns: List<String>

Returns this field's selectable options, computing them from the options supplier if one is set, otherwise returning the fixed option list.

format()

Returns: String

Serialises this field back to the compact, semicolon-separated configuration string understood by parse, for example "text=Category;required=true;options(a,b,c)". Only non-default values are included, and the subclass type (org, group or profile identifier) is appended as an empty orgs(), groups() or profid() segment where applicable.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.