Business Data Usage

The Business Data feature methods like get, save, find and delete are accessible under ivy.repo in IvyScript.

Associate value with the business case (BusinessCaseData context)

Annotate the main data class of the business case with the @BusinessCaseData annotation:

@BusinessCaseData
public class BusinessCaseDossier
{
...

Get (load or create), modify and save a dossier value in the context of the current business case:

BusinessCaseDossier dossier = ivy.repo.get(BusinessCaseDossier.class);
dossier.getPerson().setLastName("Polo");
ivy.repo.save(dossier);

Note, that the method get either loads the dossier if there is already a dossier associated with the current business case or creates a new dossier.

Warning

Business Case Data can only be applied if the case is persistent (i.e. has at least one task).

Store (without BusinessCaseData context)

Create and save:

Dossier dossier = ...
out.businessDataId = ivy.repo.save(dossier).getId();

Tip

It is recommended to only store the id of the business value in the process data. After a task switch you must load the business data value from the repo with the stored id. This is required, because the business data repo does not keep the reference to the instance on the task switch.

Load (without BusinessCaseData context)

Load, modify and save:

Dossier storedDossier = ivy.repo.find(in.businessDataId, Dossier.class);
storedDossier.getPerson().setLastName("Polo");
ivy.repo.save(storedDossier);

Store with own Id

Create and save with own Id:

Dossier dossier = ...
String yourId = ... // generate your own id, be sure it is unique!
dosser.id = yourId; // set your id to the Business Data value
ivy.repo.save(dossier);

ivy.repo.find(yourId, Dossier.class) // get your Business Data value

Warning

Be aware that the id can not be changed later and the maximum length of the identifier is 100 characters.

Samples

The WorkflowDemos sample project of the Axon.ivy Designer contains examples on how to use the Business Data Store.

See Public API of BusinessDataRepository for more code samples.