This content is dedicated to our next version. It is work in progress: its content will evolve until the new version is released.

Before that time, it cannot be considered as official.

Operations to update variables value

An operation is an action that updates the value of a variable when a task is executed. You can specify any number of operations per task, they are executed in the order they are listed.

Define operations at task level

An operation at task level updates the value of a variable defined for the task or at process level. You can also use an operation at a task to update the value of a search key.

To define an operation at task level:

  1. Select the relevant task and go to the Details panel, General tab, Operations pane.

  2. Click Add to add an operation.

  3. From the drop-down list, choose the variable to be updated.

  4. Launch the Expression Editor, by clicking the crayon icon.

  5. Using the Expression Editor, enter the expression to define the new value of the variable. If you define the expression with a script, you can use the current value of the variable being updated in the script, so, for example, you can increment a counter. Make sure that the return type matches the type of the variable being updated.

Important note: The scripts used in the operations at task level are designed to be read only scripts. It is therefor not recommended to use them to write data to the database. Ex: In a human task of a process, you add an operation that instantiates a business object with the result of a script. In the script you create and return the business object, and you also decide to update a document by calling a java API method. While this call might succeed, such a process design is considered bad practice and its behaviour is not guaranteed across Bonita versions

You can define a sequence of operations at a task. The operations are performed in the order in which they are listed, at the end of the task. You cannot re-order operations after they are defined, so you need to define the operations in the order they are to be performed.

Operation types

Business object (BO)

  • takes value of : the value of the right operand variable is used to update the value of the left operand (the BO) using the "=" operator

  • *Java method*: the left BO is updated with the value from the right operand using an invoked Java method

  • *instantiate with*: at runtime, when the operator is called, the business data variable points to the selected BO instance if it uses a Query expression type.
    The BO instance must exist in the business data database; otherwise the operator throws an exception.
    The BO instance is not modified during the operation but from that point onward, any expression or operation in the process can reference this object instance to make changes.
    If it uses a Script expression type, you can use the contract inputs to fill in the BO attributes.
    Go to Initialize BDM attributes from contract inputs in task operations for more information.

  • isDeleted: an operator 'Is Deleted' can be called on a business data variable. The BO instance that the business data references is deleted from the database, at runtime, after the task is completed.

Calling other operations (including *instantiate with*) after calling isDeleted on the same Business Object, in the same task, is not supported. If you want to re instantiate your Business Object, and perform operations on it, you should do it in a separate task.
Operations on business objects can be done only at task level.

Simple data and List of options

  • *takes value of*: the value of the right operand variable is used to update the value of the left operand using the "=" operator

Java Object

  • *takes value of*: the value of the right operand variable is used to update the value of the left operand using the "=" operator

  • *Java method*: the left object is updated with the value from the right operand using an invoked Java method

XML Object

  • *takes value of*: the value of the right operand variable is used to update the value of the left operand using the "=" operator

  • XPath update : the left object is updated with the value from the right operand using an XPath expression

Document

  • *set document*: the value of the right operand document is used to create a new version of the document