The Component library provides the possibility to extend functionality in Bizagi; by allowing you to include bespoke code to be used in the logic behind of your processes.
Through such bespoke code you may integrate with other applications, or you may extend any processing and overall operations that your processes execute.
Bespoke code that is included via the Component library, is done by registering and uploading DLL assemblies (i.e components) in Bizagi.
You may include any number of components and then choose to use them directly from Bizagi's business rules.
For introductory information about this feature, refer to Custom components.
This article provides an example regarding the use of the Component Library feature, where a custom component that uses an external API is included in Bizagi to extend its functionality.
What you need to do in Bizagi
To use the Component library feature, these steps are carried out:
1. Building your component (a compiled output).
2. Registering the component in Bizagi.
3. Creating the business rule which invokes the component.
When developing a component for the .NET edition, you need to ensure that this component is compiled and works for the supported framework used by Bizagi.
In Bizagi PaaS, the framework used in a .NET platform is version number 4.6.1.
We will illustrate this through a sample Credit Request Process.
Notice that this is a simplified example, in which we will validate that the Applicant is not reported in a central Black List in the service task called “Verify Blacklist”.
In this service task, we will create a business rules that accesses our developed component to make use of that given API. Through this API, we invoke a method that returns whether or not the applicant's id is listed in the Blacklist (true or false).
We will illustrate how to use the Component library feature for a .NET project.
Building your component (a compiled output)
Our first step is to develop the component as a class library project.
In our sample component called “MyCreditBureauComponent”, we make use of a “CreditBureau.dll”, which represents an example API.
Notice we include the reference in our component.
For the .NET edition, we build the class library project as a dll assembly.
Notice our component’s namespace is called “MyCreditBureauComponent”, and that our Class is public (called “Class1”). The method we will use in this example is called “IsCustomerInBlackList”.
Registering the component in Bizagi
Having built the component’s assembly in our previous step, we will use the “MyCreditBureauComponent.dll” output to register the component in Bizagi's component library.
To do this, we go to Bizagi Studio’s Tools and add a new component:
Find the .dll file and then click on open, we upload the MyCreditBureauComponent.dll assembly:
Once the component is added, give a Display name and a Description.
Given that this component references and uses another class library (the API), we need to register and include this API into our component library as well.
Therefore, we repeat the steps to add a component, but this time we do it for the CreditBureau.dll assembly.
In the end, we need to have registered our 2 assemblies as 2 separate components:
Creating the business rule which invokes the component
Now that we have registered our component in the Component library, we proceed to create a business rule which invokes the component’s method.
For the sake of simplicity, the following example shows how to call this component from directly within a business rule.
However, as a best practice in terms of maintainability of your solution, it is recommended to create a global rule (a library rule) that receives input parameters, invokes the component and returns output parameters.
This way, business rules call this global rule, and you have a single point in Bizagi coupled to your component.
Members of your team working on the same project just need to know which global rule to use.
To do this, we go to the Activity Actions view from our Process wizard, and select the “Verify black list” service task. We include a business rule in this point in the Process:
In the expression, we invoke our MyCreditBureauComponent’s method with the following syntax:
Notice that our Class is not defined as a static class, and therefore we can previously create an instance of it, to invoke its methods. In our example, the complete expression invokes the IsCustomerInBlackList method by:
•Sending out the Applicant’s id.
•Storing the method’s result in the CreditRequest.InBlackList Boolean-type attribute.
This is the expression’s content:
var temp = new Class1();
At this point, we are set using a custom developed component with the Component library feature in Bizagi!
To see this example working, we execute our Process in Bizagi's Work Portal by clicking in the “Run Process” option:
We can see that after the “Verify black list” service task, our next Activity will show the result of our component’s method invocation: