Interface ICustomFields
You can use custom fields to store additional, customer specific information on a task and/or case. You can use custom fields to search for or filter tasks and/or cases.
Examples:
Setting a custom field:
ivy.task.customFields().stringField("branchOffice").set("Zug");
Getting a custom field:
String branchOffice = ivy.task.customFields().stringField("branchOffice").getOrDefault("Luzern")
Getting all custom fields:
import ch.ivyteam.ivy.workflow.custom.field.ICustomField;
List<ICustomField> customFields = ivy.task.customFields().all();
Search for tasks:
TaskQuery.create().where()
.customField().stringField("branchOffice").isEqual("Zug")
.and()
.customField().numberField("creditLimit").isGreaterThan(10_000);
- Since:
- 7.3
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionList<ICustomField<?>>
all()
Examples:int
hashCode()
numberField
(String name) Returns the number custom field with the given name.stringField
(String name) Returns the string custom field with the given name.Returns the text custom field with the given name.timestampField
(String name) Returns the timestamp custom field with the given name.toString()
-
Method Details
-
stringField
Returns the string custom field with the given name.
A string custom field can store up to 2000 characters.
If you have larger data then consider splitting it up into multiple string fields or use a
text field
which can store up to 2 GByte. Note that string fields have a much better search and filter performance thantext fields
. To get both advantages store the large information in atext field
and the keywords you want to search or filter for in string fields. Consider also to store documents using thedocument
API.Examples:
Setting a string custom field:
ivy.task.customFields().stringField("branchOffice").set("Zug");
Getting a string custom field:
String branchOffice = ivy.task.customFields().stringField("branchOffice").getOrDefault("Luzern");
- Parameters:
name
- the name of the custom field- Returns:
- string custom field with the provided name
- See Also:
- API:
- This public API is available in Java.
-
textField
Returns the text custom field with the given name.
A text custom field can store up to 2 GByte of data.
Note that a text field has a bad search and filter performance. We suggest to use
string fields
instead of text fields if possible. Note that astring field
can only store up to 2000 character. If you have larger data then consider splitting it up into multiplestring fields
or store the large information in a text field and the keywords you want to search or filter for instring fields
. Consider also to store documents using thedocument
API.Examples:
Setting a text custom field:
ivy.task.customFields().textField("contract").set(in.contractFile.read());
Getting a text custom field:
String contract = ivy.task.customFields().textField("contract").getOrDefault("No contract available");
- Parameters:
name
- the name of the custom field- Returns:
- text custom field with the provided name
- See Also:
- API:
- This public API is available in Java.
-
numberField
Returns the number custom field with the given name.
A number custom field can store numbers with 30 digits before and 10 digits after the comma.
Examples:
Setting a number custom field:
ivy.case.customFields().numberField("mortage").set(875000);
Getting a number custom field:
Number mortage = ivy.task.customFields().numberField("mortage").getOrDefault(0);
- Parameters:
name
- the name of the custom field- Returns:
- number custom field with the provided name
- See Also:
- API:
- This public API is available in Java.
-
timestampField
Returns the timestamp custom field with the given name.
A timestamp custom field can store date and time information with a resolution of at least 1 second.
Examples:
Setting a timestamp custom field:
ivy.case.customFields().timestampField("mortageStart").set('1.12.2018');
Getting a timestamp custom field:
Date mortageStart = ivy.task.customFields().numberField("mortageStart").getOrDefault(new Date());
- Parameters:
name
- the name of the custom field- Returns:
- timestamp custom field with the provided name
- See Also:
- API:
- This public API is available in Java.
-
all
List<ICustomField<?>> all()Examples:
import ch.ivyteam.ivy.workflow.custom.field.ICustomField; List<ICustomField> customFields = ivy.task.customFields().all();
- Returns:
- all custom fields of a task or case
- API:
- This public API is available in Java.
-
hashCode
int hashCode()- API:
- This public API is available in Java.
-
toString
String toString()- API:
- This public API is available in Java.
-