Import data into Bizagi using SOA Layer article provides a simple and fast solution on how developers can add huge amounts of data into parametric entities.
I encountered this issues while I was working on my second project as a Bizagi consultant. One of my tasks was to build a form with a lot of elements and one of those elements was a dropdown containing all the countries. Before that I only had dropdown lists with not more than 10 values. 10 values can be added manually, easy and fast. But what about 196? Not a chance!
My solution was simple. Thankfully, Bizagi provides a service-oriented API where you can invoke different methods and do crazy things like: create new instances of Bizagi Processes, execute a Process Activity, trigger an Event or search for and update business information of Processes instances, amongst others.
To access the SOA layer‘s web services please go to this URL:
For more details please visit Bizagi API for external applications
How to import data
- STEP 1. Build the XML structure of the parametric entity
Open Bizagi Studio and go to Modules. Select Entities from the left panel and after that look for the parametric entity. In my example the parametric entity is called P_Country. Right click on it and select XML Schemas…A new window is opened Entity XML Schemas. Click on Generate button.Select all attributes and click OK.Copy the XML Schema code and go to xsd2xml website to generate the XML.
<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="P_Country"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" maxOccurs="1" name="Description" type="xs:string" /> <xs:element minOccurs="0" maxOccurs="1" name="Code" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
The final XML has to look like this (notice that I added 2 new elements BizAgiWSParam and Entities):
<BizAgiWSParam> <Entities> <P_Country> <Code></Code> <Description></Description> </P_Country> </Entities> </BizAgiWSParam>
Let’s asume that you have the values of in the database. Use a query to create from scratch the Final XML. Use CDATA section in case you have to deal with special characters.
DECLARE @XML VARCHAR(MAX) SET @XML = '<BizAgiWSParam><Entities>' SELECT @XML += '<P_Country><Code><![CDATA[' + CAST([Code] AS VARCHAR(50)) + ']]></Code><Description><![CDATA[' + CAST([Description] AS VARCHAR(100)) + ']]></Description></P_Country>' FROM CountryTable SELECT @XML + '</Entities></BizAgiWSParam>' AS [Final XML]
Please access this URL: http://[Server_name]/[Bizagi_project]/webservices/entitymanagersoa.asmx?wsdl
Open SoapUI and create new project. Find the method saveEntityAsString and make a request using the XML that we build on step 1. If everything runs without any errors you should be able to see all the values into your parametric entity.