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 TypeMethodDescriptionbooleancompareAndSet(T expectedValue, T newValue) Sets the givennewValueif the current value of the field is equal to theexpectedValueotherwise the value is not set.voiddelete()Deletes the value of this fieldget()Gets the value of the custom field oremptyif no value has been set.getOrDefault(T defaultValue) Gets the value of the custom field or the provideddefaultValueif no value has been set.Gets the value of the custom field or null/default.inthashCode()booleanmeta()Gets meta information of this custom fieldname()Example:voidSets the value of the field.type()Example:
-
Method Details
-
get
Gets the value of the custom field oremptyif no value has been set.- Returns:
- optional with the value or empty
- See Also:
- API:
- This public API is available in Java.
-
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 Java.
-
getOrDefault
Gets the value of the custom field or the provideddefaultValueif 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 Java.
-
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 Java.
-
set
Sets the value of the field.
Set of
nullhas 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 Java.
-
compareAndSet
Sets the given
newValueif the current value of the field is equal to theexpectedValueotherwise 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
nullhas the same effect asdelete(). Expecting anullvalue means that thenewValueis 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 Java.
-
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 Java.
-
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 Java.
-
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 Java.
-
meta
ICustomFieldMeta meta()Gets meta information of this custom field- Returns:
- meta information of the custom field
- API:
- This public API is available in Java.
-
hashCode
int hashCode()- API:
- This public API is available in Java.
-