Force attribute to deploy

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples >

Force attribute to deploy

Bizagi's expression analyzer is very robust identifying all attributes, entities, etc., that are to be sent in deployment packages to the Testing and Production environments.

However, sometimes attributes of the data model are not included in a deployment package and when testing a deployed package in the Testing environment the run-time fails because an attribute is not found.

This happens when such attribute is used exclusively within an expression and nowhere else, such as forms or allocations. Additionally the expression where such attribute is used is built in a way that Bizagi is not able to detect it.

 

When building complex, dynamic expressions, we recommend using the following sentence to force Bizagi to include attributes that are not included in a deployment.

 

CHelper.usingAttrib("EntityName", "AttribName")

 

The sentence receives two parameters:

The entity where the attribute is saved

The attribute to be forced in the deployment.

 

Both parameters must be typed within double quotation marks. DO NOT use variables as parameters.

The inclusion of the sentence in an expression has no effect on the result of it. You can include it at the beginning or at the end. We recommend including it at the beginning to identify easier.

 

Example

When using variables as filters in a GetEntity sentences to filter an entity, the attributes contained within the filter variable are not taken in a deployment package unless used in forms or allocations.

The following sentence displays how the attribute IsAdditional, that is used exclusively in the expression, is not taken in a deployment package. The sentence usingAttrib must be used.

 

var Filter = "IsAdditional = 1 AND cAmounttoPay > 0";

var Transactions = CEntityManager.GetEntity("Installment").GetEntityList("","",Filter,"");

for(var i =0; i < Transactions.Length; i++)

{

 var Transaction = Me.newCollectionItem("Transfer.Transactions")

 Transaction.setXPath("Transaction",Transactions[i].SurrogateKeyValue);

}

CHelper.usingAttrib("Installment", "IsAdditional");

 

The image below displays the error message received in the Work Portal when an attribute within an expression is not found in the project.

 

Using1

 

 

 

Example

When creating an xPath as a string and saving it in a variable, Bizagi is not able to identify the attributes contained. If the attributes included in an XPath built as a string are not used in forms or allocations, they wille not taken in a deployment package.

The following sentence displays how the xPath sPath is built dynamically and saved in a variable as a string. The attribute IdUser used exclusively in this expression is not taken in a deployment. The sentence usingAttrib must be used.

 

var idActivity=CHelper.getEntityAttrib("Activity","idActivity","sName='"+Me.Task.Name+"'");

var idValRole=CHelper.getEntityAttrib("ActivityConfigurat","idValidationRole","idactivity='"+idActivity+"'");

var sPath="Request.AllUsers[idValidationRole.id ="+idValRole+"].idUser";

Me.setXPath(sPath,Me.Case.WorkingCredential.UserId);

CHelper.usingAttrib("AllUsers", "idUser");