Interface ICustomField<T>
- Type Parameters:
T
-
- All Known Subinterfaces:
ICustomNumberField
,ICustomStringField
,ICustomTimestampField
You can use a custom field to store additional, customer specific information on a task and case. You can use a custom field to search for or filter tasks and cases.
- Since:
- 7.3
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
compareAndSet
(T expectedValue, T newValue) Sets the givennewValue
if the current value of the field is equal to theexpectedValue
otherwise the value is not set.void
delete()
Deletes the value of this fieldget()
Gets the value of the custom field orempty
if no value has been set.getOrDefault
(T defaultValue) Gets the value of the custom field or the provideddefaultValue
if no value has been set.Gets the value of the custom field or null/default.boolean
meta()
Gets meta information of this custom fieldname()
Example:void
Sets the value of the field.type()
Example:
-
Method Details
-
get
Gets the value of the custom field orempty
if no value has been set.- Returns:
- optional with the value or empty
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getOrNull
T getOrNull()Gets the value of the custom field or null/default.Examples:
String branchOffice = ivy.task.customFields().stringField("branchOffice").getOrNull();
- Returns:
- value or null
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getOrDefault
Gets the value of the custom field or the provideddefaultValue
if no value has been set.Examples:
String branchOffice = ivy.task.customFields().stringField("branchOffice").getOrDefault("Luzern");
- Parameters:
defaultValue
- the value that is returned if no value has been set on the field- Returns:
- value or defaultValue if not value has been set
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
isPresent
boolean isPresent()- Returns:
- true if a value is present, false if no value has been set
Examples:
boolean hasBranchOffice = ivy.task.customFields().stringField("branchOffice").isPresent();
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
set
Sets the value of the field.
Set of
null
has the same effect asdelete()
.Examples:
ivy.task.customFields().stringField("branchOffice").set("Zug");
- Parameters:
value
- new value of the field- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
compareAndSet
Sets the given
newValue
if the current value of the field is equal to theexpectedValue
otherwise the value is not set.This is an atomic operation. During the read of the current value and the set of the new value parallel transactions are blocked and cannot change the value in the meantime.
Setting of a
null
has the same effect asdelete()
. Expecting anull
value means that thenewValue
is only set if currently no value is set.Examples:
boolean successful = ivy.task.customFields().stringField("salesState").compareAndSet("FirstContact", "OfferSent");
- Parameters:
expectedValue
- the expected valuenewValue
- the new value- Returns:
- true if the new value was set otherwise false
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
delete
void delete()Deletes the value of this field
Examples:
ivy.task.customFields().stringField("branchOffice").delete();
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
name
String name()Example:
import ch.ivyteam.ivy.workflow.custom.field.ICustomField; List<String> names; for (ICustomField field : ivy.task.customFields().all()) { names.add(field.name()); }
- Returns:
- name of the field
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
type
CustomFieldType type()Example:
import ch.ivyteam.ivy.workflow.custom.field.ICustomField; import ch.ivyteam.ivy.workflow.custom.field.CustomFieldType; List<CustomFieldType> types; for (ICustomField field : ivy.task.customFields().all()) { types.add(field.type()); }
- Returns:
- type of the field
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
meta
ICustomFieldMeta meta()Gets meta information of this custom field- Returns:
- meta information of the custom field
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-