Content
EntityManagerSOA web methods
getEntityAsString
https://___.bizagi.com/webservices/EntityManagerSOA.asmx?op=getEntitiesAsString
Simple query
<BizAgiWSParam>
<EntityData>
<EntityName>mFacility</EntityName>
</EntityData>
</BizAgiWSParam>
Using a complex filter
<BizAgiWSParam>
<EntityData>
<EntityName>mFacility</EntityName>
<Filters>
<![CDATA[sName='...' AND bActive=1 AND dStartDate > '2023-06-20T00:00:00' AND idmFacility=99]]>
</Filters>
</EntityData>
</BizAgiWSParam>
The filter accepts only the attributes of the entity. If you are trying to filter by a relation/pointer to another entity, the call will return an error as column not found.
saveEntityAsString
https://___.bizagi.com/webservices/EntityManagerSOA.asmx?op=saveEntitiesAsString
Update User
An update can be differentiated from an insertion because the update requires the explicit specification of the primary key (or business key) of the record to be updated, e.g. key=”value” (or businessKey=”Attribute=value”); the insertions do not require this specification.
<BizAgiWSParam>
<Entities>
<WFUSER businessKey="domain='desktop-33pg18r' AND userName='alex.smith'">
<fullName>Alex Smith</fullName>
<userName>alex.smith</userName>
<domain>desktop-33pg18r</domain>
<contactEmail>alex.smith@mail.com</contactEmail>
<Roles>
<ROLE key="10001"/>
<ROLE key="10002"/>
</Roles>
</WFUSER>
...
<WFUSER>...</WFUSER>
</Entities>
</BizAgiWSParam>
<BizAgiWSParam>
<Entities>
<mFacility>
<sName>...</sName>
<bActive>false</bActive>
<xmOwners>
<mPerson>
<kpRole businessKey = "sCode='Owner'"/>
<ksWFUser businessKey = "domain = 'domain' AND userName = 'admon'"/>
</mPerson>
</xmOwners>
</mFacility>
</Entities>
</BizAgiWSParam>
Remove the roles (id 1,2 …) from the user with the id 108700
<BizAgiWSParam>
<Entities>
<WFUSER key="108700">
<Roles>
<REMOVE>
<idRole key="1"/>
<idRole key="2"/>
...
</REMOVE>
</Roles>
</WFUSER>
</Entities>
</BizAgiWSParam>
<BizAgiWSParam>
<Entities>
<WFUSER businessKey = "idUser = 1001">
<REMOVE>
<StakeHolders>
<Add Stakeholder Name Here/>
</StakeHolders>
</REMOVE>
</WFUSER>
</Entities>
</BizAgiWSParam>
Bizagi expression
// --- add new entry to the case history collection
var sAction = "Task Reassignment";
var sDetails = System.String.Format(LPT.Global_GetMessage(Me,78), sTaskDisplayName, sLoggedUserFullName, sReassignToFullName);
var dDateTimeNow = DateTime.Now;
var sDateTimeNow = XmlConvert.ToString(dDateTimeNow, XmlDateTimeSerializationMode.Unspecified);
var dDateTimeToday = DateTime.Now;
var sDateTimeToday = XmlConvert.ToString(dDateTimeToday, XmlDateTimeSerializationMode.Unspecified);
// --- build the XML
var sXML = ''+
'<BizAgiWSParam>'+
'<Entities>'+
'<mLP_CaseInformation key="'+ iCaseInfoId + '">'+
'<xCaseHistory>'+
'<mLP_CaseHistory>'+
'<dDate>'+ sDateTimeToday + '</dDate>'+
'<sAction>'+ sAction + '</sAction>'+
'<ksWFUser key="'+ iLoggedUserId + '"/>'+
'<sDetails><![CDATA['+ sDetails + ']]></sDetails>'+
'<dDateTime>'+ sDateTimeNow + '</dDateTime>'+
'</mLP_CaseHistory>'+
'</xCaseHistory>'+
'</mLP_CaseInformation>'+
'</Entities>'+
'</BizAgiWSParam>';
// --- save entity as string
CEntityXmlHelper.saveEntityAsString(sXML);
DateTime attribute example;
Execute Events
var sXML = "<BizAgiWSParam>"
+"<domain>domain</domain>"
+"<userName>Admon</userName>"
+"<Events>"
+"<Event>"
+"<EventData>"
+"<radNumber>" + Me.Case.CaseNumber + "</radNumber>"
+"<eventName>CloseCase</eventName>"
+"</EventData>"
+"<Entities></Entities>"
+"</Event>"
+"</Events>"
+"</BizAgiWSParam>";
CHelper.setEvent(sXML);
Instead of radNumber you can use idCase:
var sXML = "<BizAgiWSParam>"
+"<domain>domain</domain>"
+"<userName>Admon</userName>"
+"<Events>"
+"<Event>"
+"<EventData>"
+"<idCase>" + Me.Case.Id + "</idCase>"
+"<eventName>CloseCase</eventName>"
+"</EventData>"
+"<Entities></Entities>"
+"</Event>"
+"</Events>"
+"</BizAgiWSParam>";
CHelper.setEvent(sXML);
Read more here.
Execute Activity
var sXML = "<BizAgiWSParam>
<domain>domain</domain>
<userName>admon</userName>
<ActivityData>
<taskId>79</taskId>
<idCase>"+casenumber+"</idCase>
<idWorkItem>"+WorkItemId+"</idWorkItem>
</ActivityData>
<Entities>
<XPath XPath=\"SuscriptionProcess.Beneficiaries.hasBeneficiaries\">false</XPath>
</Entities>
</BizAgiWSParam>"
CHelper.PerformActivity(sXML);
Read more here.
Create a new case
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);
Read more here.