How to perform a Bizagi Activity from other applications

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > How To´s > Integration how-to's >

How to perform a Bizagi Activity from other applications


A common integration requirement in corporate projects, is to have the possibility for end users to advance their assigned activities via an application or an external portal (e.g SharePoint, an E-mail or custom application, or any other program).


In Bizagi, processes already present a comprehensive set of Web services and methods so that all their functionality can be invoked from any other application.

Such possibility is available through Bizagi SOA layer.


For further information about this feature, refer to Invoking Bizagi services from external applications.


What you need to do

To complete pending activities and advance the Process workflow in Bizagi from other applications, all you need to do is to invoke the performActivityAsString Web method, which is already published in your project's Work Portal.


This Web method belongs to the WorkflowEngineSOA Web services published by default at http://[your_server]/[your_project]/WebServices/WorkflowEngineSOA.asmx?wsdl (for the .NET edition).

For complete information about the access URL to these Web services, refer to SOA Layer URL and considerations.


While invoking the performActivityAsString, or the performActivity Web methods available for Bizagi .NET, you will send out XML-structured input mainly containing: The user performing the Activity, the specific work item to work with (the actual pending Task instance for a given case), and any additional business information considered relevant (any data, attachments, etc).


To view further detail about the performActivityAsString input and output structure, refer to performActivityAsString.



The following example is carried out using the Vacation Request Process as published at the Process Xchange templates.




For this Process, we will advance the Register Vacation Leave Request Activity from an external application.


To include additional business information or edit the existing one, in this Activity, it is important that we become familiar with the data model involved.

We want to include data required in this Activity which corresponds to the expected input information in its form, which corresponds to: The vacation starting and ending dates, and the number of office days requested.


This information corresponds to the following attributes of our Process entity called VacationRequest.




Defining the Input XML

It is important to use the exact name of the elements as expected by Bizagi in the XML structure.

For example, the value contained in the <taskName> tag must be the name of the Activity itself, and not its display name.

Likewise, the first tag under the <Entities> tag will correspond to the reference attribute at the Application Entity which relates to your Process Entity (VacationRequest).

From there on, use also the corresponding attribute or collection name that navigates to the attributes you want to assign values to.

Never use display names, and also make sure that you input this information in a case-sensitive manner.


To review information about how is the business information expected in Bizagi's data model, refer to Data model XML schemas.


To view the exact name of the Register Vacation Leave Request Activity, go to the first step in the Process Wizard (Model Process) and view the details for the given Activity.




In our example and to advance this Activity we just looked up, the following XML structure is sent as input:
















Note that this example XML completes this Activity for the Vacation Request Process instance having an idCase number of 1001.



The <Entities> tag is optional. You may choose to just advance Activities without sending any business information.

Doing so, is accomplished by NOT including this tag and any information in it.


The external application

We will now use a simple Windows Application to simulate an external application as a portal which advances a pending Activity in a Bizagi process.

In this dummy Application, business information is inputted and then a button is clicked to invoke the web method of Bizagi SOA Layer.




Since this example is worked with Bizagi .NET edition, we can either invoke the performActivityAsString or performActivity web method.


For this example worked in a .NET application in Visual Studio, we previously defined a Web Reference that points to our performActivity web URL:




Once the button is clicked, the case is created using Bizagi SOA Layer. Within the response information (output), we receive an error message should the invocation fail, along with other additional information.




The code behind the button-click event is:    

private void button2_Click(object sender, EventArgs e)




         string sStartingDate = XmlConvert.ToString(dateTimePicker1.Value, XmlDateTimeSerializationMode.Unspecified);

         string sSEndingDate = XmlConvert.ToString(dateTimePicker2.Value, XmlDateTimeSerializationMode.Unspecified);


         string sXml = "<BizAgiWSParam>";

         sXml += "<ActivityData>";

         sXml += "<idCase>" + textBox2.Text + "</idCase>";

         sXml += "<taskName>Task1</taskName>";

         sXml += "</ActivityData>";

         sXml += "<Entities>";

         sXml += "<VacationRequest>";

         sXml += "<VacationStartingDate>" + sStartingDate + "</VacationStartingDate>";

         sXml += "<VacationEndingDate>" + sSEndingDate + "</VacationEndingDate>";

         sXml += "<NumberOfOfficeDaysReques>" + textBox1.Text + "</NumberOfOfficeDaysReques>";

         sXml += "</VacationRequest>";

         sXml += "</Entities>";

         sXml += "</BizAgiWSParam>";


         XmlDocument xDoc = new XmlDocument();


         //We use the set web reference and invoke the performActivity method

         MyFirstProcessWE.WorkflowEngineSOA ws = new MyFirstProcessWE.WorkflowEngineSOA();

         XmlNode xn = ws.performActivity(xDoc);


         //If the response information is successful, we retrieve a success message; otherwise an error                

         if (xn.SelectSingleNode("processes/process/processError/errorCode") != null)


                 label6.Text = "ERROR:" + xn.SelectSingleNode("processes/process/processError/errorMessage").InnerText;




                 label6.Text = "SUCCESS";



 catch (Exception ex)


         label6.Text = "ERROR: " + ex.Message;




         label6.Visible = true;




Verifying at the Work Portal

At our project's Work Portal at http://myServer/MyFirstProcess/, we verify that the case number 502 has successfully been moved forward from the previous Task state (Register Vacation Request), and into the next one.

The next Activity is called Approve Vacation Request and will show up the sent information: