<< Click to Display Table of Contents >> Force attribute to deploy |
Bizagi’s expression analyzer is highly robust in identifying all attributes, entities, and other elements that must be included in deployment packages for the Test and Production environments.
However, in some cases, certain attributes from the data model may not be included in a deployment package. As a result, when testing a deployed package in the Test environment, a runtime error may occur due to a missing attribute.
This issue arises when an attribute is used exclusively within an expression and is not referenced elsewhere, such as in forms or allocations. Additionally, if the expression is structured in a way that prevents Bizagi from detecting the attribute, it will not be included in the deployment.
To ensure that attributes are correctly included when working with complex and dynamic expressions, we recommend using any of the following sentences:
CHelper.usingAttrib("EntityName", "AttribName")
Where:
•EntityName: The name of the entity where the attribute is stored.
•AttribName: The name of the attribute to be included in the deployment.
CHelper.usingXPath("EntityName", "XPath")
Where:
•EntityName: The name of the entity where the attribute is stored.
•XPath: The XPath of the attribute to be included in the deployment.
CHelper.usingXPath("XPath")
Where:
•XPath: The XPath of the attribute to be included in the deployment.
All parameters must be enclosed in double quotation marks. DO NOT use variables as parameters.
Including any of these sentences in an expression does not affect its execution. You can place them at the beginning or end of the expression; however, we recommend placing them at the beginning for easier identification.
When you reference an attribute using CHelper.usingAttrib or CHelper.usingXPath, Bizagi will automatically include the entity to which that attribute belongs. Attributes cannot be deployed without their parent entities. |
When using variables as filters in a GetEntity sentence to filter an entity, the attributes contained within the filter variable are not included in the deployment package unless they are used in forms or allocations.
The following example demonstrates how the attribute IsAdditional, which is used exclusively in the expression, is not included in the deployment package. To ensure its inclusion, you can use the usingAttrib sentence:
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.usingAttrib("Installment", "IsAdditional");
The image below shows the error message that appears in the Work Portal when an attribute within an expression is not found in the project.
When creating an XPath as a string and saving it in a variable, Bizagi is unable to identify the attributes it contains. If these attributes are not used in forms or allocations, they will not be included in the deployment package.
The following example demonstrates how the XPath sPath is dynamically built and saved in a variable as a string. Since the attribute IdUser is used exclusively in this expression, it is not included in the deployment. To ensure its inclusion, you can use the usingXPath sentence:
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("Request", "idUser");
When creating a new case using the CHelper.NewCase function, the method receives an XML string as a parameter. This XML can include information about the case creator as well as business data. However, Bizagi cannot automatically detect attributes within this string.
The following example demonstrates how to create a new case of the Change Management process using an expression where the AssociatedTicket attribute is included in the XML. To ensure that this attribute is recognized, you can use the usingXPath sentence:
{
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("ChangeRequest.AssociatedTicket")
CHelper.NewCase(sXML)
}
Last Updated 3/17/2025 5:08:42 PM