Bizagi offers the possibility to create temporary attributes, where you can store information for a short time, that are not part of the data model . Access and manipulation is limited to the life of the variable’s container.
The information stored in temporary attributes will not be saved in the database. That is why is temporary: its values last for as long as the variable lasts, without affecting the data model. We can also refer to them as Scope Attributes.
Temporary attributes (Process attributes) are used in expressions and business rules, and they can be seen in the user interface (form) of Activities or Processes. Temporary attributes are used to prevent users from creating several control attributes that add no value to the data model. They might be needed as part of a calculation or validation but they do not impact the relevant information of the cases. In fact, once they are used they can be considered as 'junk' in the data model.
Imagine a Purchase request in you company were you are requesting two laptops. The cost of the purchase exceeds a limit and so it has to be approved by your immediate supervisor. The further routing of the process is governed by the value of a Boolean attribute which determines whether or not to send an approval request to the supervisor. The Boolean attribute can be temporary as it sole function is to route the Process sequence flow. It merely is needed to store the evaluation True/False value for a short period of time. Once the attribute is evaluated, and the process flow continues, it becomes redundant and is no longer needed.
These temporary attributes can:
•Store information for the time an Activity lasts
•Store information for the time a Process lasts.
Information that must be maintained permanently can not be stored in a Scope attribute. Rather, associate the contents to one of the attributes of the data model.
Create a Temporary Attribute
Firstly, determine whether the data should be available during the life span of an Activity only or during the whole life span of the Process. Once the scope of the attribute is established, you can create it. Temporary Attribute data that is declared local to an Activity is not visible to anything outside of that Activity i.e. it is data is only valid within the specific Activity of the Process and not to the rest of the Process.
Activity Temporary Attributes
1. Select the Processes component in the Expert view. Navigate the Processes until you reach the Process where the attribute will be created.
Select the Elements option and identify the Activities option. Locate the given Activity where the attribute should be created and select Attributes.
2. A new window will display the list of temporary attributes of the Activity. Create a new attribute by clicking on the plus sign Add button in the upper right corner.
3. Include a display name (that will be displayed in the Work Portal, if used in a user interface), a name (with no spaces or special characters) and a type of attribute.
You can also include a Description for documentation purposes, and a Help text that will display when the field is clicked on, in the Work Portal.
4. Scope attributes can be related to an entity (that is, they can be a Related Attribute relationship).
To create a Related Attribute relationship select the data type; in this case Big Integer (valid for a related attribute relationship), and then, choose the related entity from the drop-down list at the bottom of the Properties tab.
Relating Temporary Attributes to an entity is useful if you want to:
•Navigate through the data model to access such attributes in a easier way.
•Have access to complex temporary attributes. For example: If you have a collection of products and you want to edit one of them, you can relate a temporary attribute to that product, and edit its data. This allows you to edit such item as only one attribute, instead of managing the complete collection.
Process Temporary Attributes
1. Select the Processes component in the Expert view. Locate the given Process where the attribute will be created under the Applications classification.
Identify the Attributes option, right-click it and select Edit Attributes List.
2. Follow the remainder steps 2, 3 and 4 as stipulated above for Activity Scope Attributes.
Use a Temporary Attribute
Process Temporary Attributes can be dragged and dropped in a Form or a Business rule as any other attribute of the data model.
Similarly, Activity Scope Attributes can be dragged and dropped in a Form, but in a Business rule their NAME has to be entered between the symbols “<” and “>”.
In the forms designer, drag and drop the attribute from the Data Model in the left pane of the window.
Take into account that, at this point, the scope attribute does not have a context and therefore it may apply to any Activity that may require it.
Process scope attribute are assigned at the project level. To use the scope attribute, Select the Processes component in the Expert View and choose Expressions to launch the editor.
In the Business Rules editor (Edit Expression), click the Data Model icon and select the Purchases project. The scope attribute will be displayed at the end of the Purchases project node.
Use a Temporary Attributes in a Sub-process
Temporary attributes are created at process level, therefore if a sub-process (embedded or reusable) is created, these attributes are only available for the parent process.
In this example, we have a Temporary attribute for a parent process:
However, that Temporary attribute is not available for its embedded process:
Creating Temporary attributes in embedded sub-processes is not supported.
If you need to access to an already created Temporary attribute in a sub-process, it is necessary to create an expression in the Step 4. Business rules of the Process wizard: Activity actions, then follow these steps:
1.Identify which Temporary attributes are expected to be shown in the Sub-Process
In this case we want to display the Temporary attribute in the forms of the Sub-Process.
2.Create the Temporary attributes in the Sub-Process entity
3.Create an expression as an On enter action of the Sub-Process (holding the Shift key while clicking)
4.Create an expression element.
Associate (map) the information from the Parent Process to be used in the Sub-Process.
5.Associate the instance of the Sub-Process entity to the attribute in the Parent process used to reference the Sub-Process
//Associate the information to be reused
//Associate the Sub-Process instance to the Parent process
<Payment> = <Invoice.Payment>;
Temporary attributes can now be accessed in the Sub-Process.
Visit this article to know more about accessing the information of a parent process from a sub-process.
Both process and task attributes can only be created from the utilities list of the tags mapping window