<< Click to Display Table of Contents >> Select Parameter Value |
Overview
Bizagi acknowledges that oftentimes users might find themselves hard-coding values of parameter entities (surrogate keys) on business rules, which leads to a couple of issues:
•The need to copy and paste the name of attributes or actual values into the rule from the Data Model.
•When exporting a project from Development to test or production environment, the values of parameter entities (surrogate keys) might change, making the rules that you had previously configured to work incorrectly.
That is why Bizagi features the Select Parameter Value option on the expression editor. It allows users to explore the parameter values of the data model, select a specific value, and inject the correct expression to the editor using business keys instead of surrogate keys.
Possible issues when using surrogate keys
There are mainly two different cases on which the usage of surrogate keys on Business Rules might cause problems when deployed to test or production environments:
•The user has a set up on which for each environment there is a different database. In such case, the surrogate key value that was included on a business rule won't be the same between environments, and so, in runtime the rule execution will result in unexpected behavior or even errors.
•When using static values (surrogate keys) and changing environment, those values might not hold to be true, thus resulting in unexpected behaviors or even errors.
Select parameter value
It is strongly recommended to use Business Keys instead of Bizagi IDs (surrogate keys) in every project. Please bear in mind that you should set up those business keys beforehand, so that this option works as expected. For more information on them, visit the Business Keys article.
On every expression editor (for scripting expressions) there is a Select Parameter Value button available.
When clicked, a pop-up window will be launched showing the list of parameter entities presented on the project, as shown in the image below.
Bizagi shows a warning massage if the parameter entity selected does not have a business key configured.
Select from the drop-down list the parameter entity whose value you wish to add into the expression, and then click Load. On the main panel of the window a list of the available values will be displayed.
From that list select the specific value you wish to add to the expression and click Select. Bizagi will inject the expression that resolves to that value but using Business Keys.
The expression injected by Bizagi resolves to the value you wish to add, but it uses Business Keys. The expression in full is:
CHelper.getEntityAttrib("City","idCity"," Code = '5' AND Internal Code = 'NYC' ");
Where is this feature available?
The Select Parameter Value option is available in the expression editor, wherever it might be launched. The feature of the Business Key injection is also available in Boolean Expressions, Policies, and Actions & Validations. In this type of situations, the user chooses a control on the left-hand side of the operation and Bizagi will identify if a parameter entity is being used, in which case it will display a list of the possible values. The value selected will be automatically resolved by Bizagi to its Business Key.
Please note in the following image how Bizagi displays the list of available attributes when it identifies that the selected attribute corresponds to a parameter entity.
Important
If you have not defined a Business Key for a given entity, and you use the previously described functionality, Bizagi will resolve it using its surrogate key and the expression injected will be the same as the one described before, but the column used will be that of the surrogate key.
Considerations with parameter entities managed in the Production environment or replicated
Parameter entities can me administered in two environments, development and production. See Where to manage Parameter entities. Depending whether the entity is managed in production or is replicated, see Replication, There are some considerations when obtaining values of parameter entities in expressions using the Select Parameter value feature. The following article explains these considerations.
If you want to use values of parameters entities in expressions, business keys must be defined in the parameter entity, considering the following:
•A business key CANNOT be an attribute used as a relationship with other entities. If you try to get the values when the business key is defined using a relationship, Bizagi displays the following message:
•You must define always a business key in the parameter entity. If the entity has no business keys, Bizagi displays the following message:
Last Updated 5/30/2024 10:08:36 AM