<< Click to Display Table of Contents >> 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.usingXPath("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 usingXPath must be used.
var parameters = new FilterParameters();
parameters.AddParameter("@IsAdditional", 1);
parameters.AddParameter("@cAmounttoPay", 0);
var Transactions = Me.getXPath("entity-list('Installment', 'IsAdditional = @IsAdditional AND cAmounttoPay > @cAmounttoPay')",parameters);
for(var i =0; i < Transactions.size(); i++)
{
var Transaction = Me.newCollectionItem("Transfer.Transactions")
Transaction.setXPath("Transaction",Transactions[i].getXPath("Id"));
}
CHelper.usingXPath("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.
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 usingXPath must be used.
var parameters = new FilterParameters();
parameters.AddParameter("@sName", Me.Task.Name);
var idActivity=CHelper.getEntityAttrib("Activity","idActivity","sName=@sName",parameters);
parameters.AddParameter("@idactivity", idActivity);
var idValRole=CHelper.getEntityAttrib("ActivityConfigurat","idValidationRole","idactivity=@idactivity",parameters);
var sPath="Request.AllUsers[idValidationRole.id ="+idValRole+"].idUser";
Me.setXPath(sPath,Me.Case.WorkingCredential.UserId);
CHelper.usingXPath("AllUsers", "idUser");
Example
When a new case is created including business information from expressions using the CHelper.NewCase function. In this case, the method receives a text String of an XML as a parameter in which, it is possible to include information about the case creator as well as business information. However, Bizagi cannot identify the attributes contained in this string. The following example shows hot to create a new case of the Change Management process using an expression where the AssociatetdTicket attribute is included in the XML. In order for this attribute to be recognized, the usingXpath sencence is used.
{
var sXML ="<BizAgiWSParam>"; //start the xml document
sXML += "<domain>domain</domain>"; //domain of the user that will create the case
sXML += "<userName>HelpDeskAgent</userName>"; //user that will create the case
sXML += "<Cases><Case><Process>ChangeManagement</Process>"; //process name
sXML += "<Entities>"; //start of the business information
sXML += "<ChangeRequest>"; //name of the process entity
sXML += "<AssociatedTicket>" + Me.Case.CaseNumber + "</AssociatedTicket>"; //business information <attribute>value</attribute>
sXML += "</ChangeRequest></Entities></Case></Cases></BizAgiWSParam>"; //close the xml document
CHelper.usingXpath("AssociatedTicket")
CHelper.NewCase(sXML)
}
Last Updated 1/6/2022 4:20:26 PM