Interface ICustomField<T>
-
- Type Parameters:
T
-
- All Known Subinterfaces:
ICustomNumberField
,ICustomStringField
,ICustomTimestampField
public interface ICustomField<T>
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
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 fieldOptional<T>
get()
Gets the value of the custom field orempty
if no value has been set.T
getOrDefault(T defaultValue)
Gets the value of the custom field or the provideddefaultValue
if no value has been set.T
getOrNull()
Gets the value of the custom field or null/default.boolean
isPresent()
String
name()
Example:void
set(T value)
Sets the value of the field.CustomFieldType
type()
Example:
-
-
-
Method Detail
-
get
Optional<T> get()
Gets the value of the custom field orempty
if no value has been set.- Returns:
- optional with the value or empty
- See Also:
getOrNull()
,getOrDefault(Object)
,isPresent()
- 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:
getOrDefault(Object)
,get()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getOrDefault
T getOrDefault(T defaultValue)
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:
getOrNull()
,get()
- 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:
set(Object)
,delete()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
set
void set(T value)
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:
compareAndSet(Object, Object)
,delete()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
compareAndSet
boolean compareAndSet(T expectedValue, T newValue)
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:
isPresent()
- 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.
-
-