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
| Property | Returns | Description |
|---|---|---|
| aggregate | boolean | Whether this field's values should be aggregated, for example when used to define a metric. |
| expression | String | An expression associated with this field, used when the field represents a computed or filterable value. |
| fileUpload | boolean | Whether this field renders as a file upload control rather than a text input. |
| group | Group | The group this field is associated with, when the field was parsed for a specific group. |
| help | String | Help text to display alongside this field's form control. |
| hidden | boolean | Whether this field is hidden from the form it is otherwise rendered on. |
| html | String | Renders this field as an HTML form control, using its current value. |
| indexed | boolean | Whether this field's value should be included in the search index. |
| kcodeSelection | boolean | Whether this field's options are selected from kcode values rather than plain strings. |
| name | String | The name of this field, used as its key in configuration strings and as the form control's name attribute. |
| operators | 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. |
| options | List<String> | The fixed list of selectable option values for this field, if it has been given one directly rather than an options supplier. |
| ordering | Integer | The relative display order of this field amongst a set of fields; lower values sort first. |
| required | boolean | Whether a value must be given for this field. |
| rows | 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. |
| text | 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. |
| title | String | The display label for this field. |
| type | String | The data type of this field's value, for example "string" or "integer". |
| value | String | The 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.
| Parameter | Description |
|---|---|
ss | the 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.
| Parameter | Description |
|---|---|
optionsFn | the 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.
| Parameter | Description |
|---|---|
optionsJsFn | the 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.
| Parameter | Description |
|---|---|
help | the 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.
| Parameter | Description |
|---|---|
value | the 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.
| Parameter | Description |
|---|---|
expression | the 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".
| Parameter | Description |
|---|---|
type | the 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.
| Parameter | Description |
|---|---|
operators | the 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.
| Parameter | Description |
|---|---|
ordering | the 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.
| Parameter | Description |
|---|---|
rows | the 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.
| Parameter | Description |
|---|---|
value | the 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.
| Parameter | Description |
|---|---|
oValue | the value to render into the form control |
extraClasses | additional CSS classes to add to the form control, may be null |
namePrefix | a 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.
| Parameter | Description |
|---|---|
oValue | the value to render into the form control |
extraClasses | additional CSS classes to add to the form control, may be null |
namePrefix | a prefix to prepend to the form control's name attribute, may be null |
owner | the 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.
| Parameter | Description |
|---|---|
pair | the 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.
| Parameter | Description |
|---|---|
object | the object the value would be applied to |
value | the 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.
| Parameter | Description |
|---|---|
name | the field's name |
setRequired(boolean required)
Returns: void
Sets whether a value must be given for this field.
| Parameter | Description |
|---|---|
required | true 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.
| Parameter | Description |
|---|---|
aggregate | true 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.
| Parameter | Description |
|---|---|
h | true to hide the field |
setIndexed(boolean indexed)
Returns: void
Sets whether this field's value should be included in the search index.
| Parameter | Description |
|---|---|
indexed | true to index the field |
setFileUpload(boolean fileUpload)
Returns: void
Sets whether this field renders as a file upload control rather than a text input.
| Parameter | Description |
|---|---|
fileUpload | true 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.
| Parameter | Description |
|---|---|
kcodeSelection | true to use kcode selection |
setText(String text)
Returns: void
Sets the placeholder or prompt text shown for this field.
| Parameter | Description |
|---|---|
text | the field's text |
setTitle(String title)
Returns: void
Sets the display label for this field.
| Parameter | Description |
|---|---|
title | the field's title |
setOptions(List<String> options)
Returns: void
Sets a fixed list of selectable option values for this field, replacing any previous options.
| Parameter | Description |
|---|---|
options | the selectable option values |
setGroup(Group group)
Returns: void
Sets the group this field is associated with.
| Parameter | Description |
|---|---|
group | the associated group |
title(String s)
Returns: ExtraField
Sets the display label for this field.
| Parameter | Description |
|---|---|
s | the field's title |
text(String s)
Returns: ExtraField
Sets the placeholder or prompt text shown for this field.
| Parameter | Description |
|---|---|
s | the field's text |
help(String s)
Returns: ExtraField
Sets the help text to display alongside this field's form control.
| Parameter | Description |
|---|---|
s | the 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".
| Parameter | Description |
|---|---|
s | the field's type |
required(boolean b)
Returns: ExtraField
Sets whether a value must be given for this field.
| Parameter | Description |
|---|---|
b | true if the field is required |
rows(int s)
Returns: ExtraField
Sets the number of rows to render this field as a textarea with.
| Parameter | Description |
|---|---|
s | the number of textarea rows |
fileUpload(boolean b)
Returns: ExtraField
Sets whether this field renders as a file upload control rather than a text input.
| Parameter | Description |
|---|---|
b | true 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.
| Parameter | Description |
|---|---|
b | true 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.