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

    Modifier and Type
    Method
    Description
    boolean
    compareAndSet(T expectedValue, T newValue)
    Sets the given newValue if the current value of the field is equal to the expectedValue otherwise the value is not set.
    void
    Deletes the value of this field
    get()
    Gets the value of the custom field or empty if no value has been set.
    getOrDefault(T defaultValue)
    Gets the value of the custom field or the provided defaultValue if no value has been set.
    Gets the value of the custom field or null/default.
    boolean
     
    Gets meta information of this custom field
    Example:
    void
    set(T value)
    Sets the value of the field.
    Example:
  • Method Details

    • get

      Optional<T> get()
      Gets the value of the custom field or empty 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

      T getOrDefault(T defaultValue)
      Gets the value of the custom field or the provided defaultValue 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

      void set(T value)

      Sets the value of the field.

      Set of null has the same effect as delete().

      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

      boolean compareAndSet(T expectedValue, T newValue)

      Sets the given newValue if the current value of the field is equal to the expectedValue 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 as delete(). Expecting a null value means that the newValue is only set if currently no value is set.

      Examples:

      boolean successful = ivy.task.customFields().stringField("salesState").compareAndSet("FirstContact", "OfferSent");
      Parameters:
      expectedValue - the expected value
      newValue - 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

      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

      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.