Answered
Commit data in bizagi process
i want to commit data in the middle of the expression. for example
var x = Me.newCollectionItem(...)
//commit data
//
and my newed collection item commited after I call commit command . Can I do this? And if commit inside the rule is impossible, when bizagi commit data ? I think data will be commited just user task forms and end of the process . is there another way?
Dear Bardia,
Thank you for letting us know your questions. Unfortunately, committing data in the middle of an expression is not possible. The data from the activity is accessible only by the activity.
Kind regards,
Laura G
Hello Bardia,
all data that are added via UI forms or expression using Me.setXPath or <EntityName> = "value" etc, will be stored in scope and available only to user who is working on the case. Data are commited once process step is completed.
But there is option to commit data directly to database using CEntityXmlHelper
Here is sample expression:
//obtain process entity id
var iCaseProcessId = <DemoProcess.id>;
//make sure that you have stored at least some data in process entity, otherwise it will return null
if(iCaseProcessId){
//define xml and assign value to relevant attribute/collection
//define process entity record to avoid creating of new row in process entity
var sXml = '<?xml version="1.0" encoding="utf-8"?>'
+ '<BizAgiWSParam><Entities><DemoProcess key="'+iCaseProcessId+'">'
+ '<SampleField>'+ DateTime.Now +'</SampleField>'
+ '<SampleCollection>'
+ '<SampleEntity><SampleEntityAttribute>Add row 1</SampleEntityAttribute></SampleEntity>'
+ '<SampleEntity><SampleEntityAttribute>Add row 2</SampleEntityAttribute></SampleEntity>'
+ '</SampleCollection>'
+ '</DemoProcess></Entities></BizAgiWSParam>';
//use CEntityXmlHelper to commit data to database
var sResult = CEntityXmlHelper.saveEntityAsString(sXml);
CHelper.trace("TraceFile", sResult);
}
else {
CHelper.ThrowValidationError("Process entity is empty")
}
Above rule will commit data directly to database and it will be available for other users/cases/activities that are "obsering process"
Martin
Comments have been locked on this page!