Trello Application Example – Part 1

In this article, we would like to share with you a example of a nice Bonita BPM application using Trello.
Here is a summary of what it does:

  • Helps you create credentials to connect Bonita BPM to a Trello API
  • Retrieves JSON information from a Trello board
  • Creates a downloadable CSV and displays the table in a Bonita BPM form
  • Stores the credentials, so you can use them later when starting a new case from the application in the Portal.

The first part  of this article is aimed at the beginner. We will review the example, see how to set up a subprocess,  and how to store credentials. In the second part, aimed at the developer, we will see how the Trello Connector has been designed in Bonita BPM Studio. All resources used in this How to will be available on GitHub.

Process overview

Before drawing the entire application, we started with a basic one, containing just two human tasks, in order to test how the Trello API works:

  • The first task asks for the credentials to connect to Trello API
  • The second task displays retrieved data

In this way, it was easy to work on the Java application of the Trello connector. Once done and tested, we have the full application with all the forms. The aim was to create not only an application to retrieve data, but a more complete application that will help people to create the credentials, and store them for future use in Bonita BPM.

Here is the diagram:

So let’s describe this process:

  • The first step is automatic and checks if there are already Trello credentials. If this is the first time you are starting the application, there are no credentials. In which case, you can go straight to “Set up your account”. If the information is already available (e.g: the second time you start the application) the second step will display it. If you want to make changes, go to “Set up your account”
  • “Set up your account” is a “Call activity” and it will start the process on the second pool
  • This subprocess helps you to generate a Trello API Key and Token
  • Once done, go to “Choose the board”. Simply provide the link to the Trello board you want to use in the application or leave the one you defined before
  • “Retrieve Trello data” will check if all the information is correct, retrieve JSON data from Trello API and convert it to a CSV table. The Trello connector is on this step
  • If there are no errors, the final step will show you the table, and provide a link to download it as a CSV file. However, if you do get an error, you should check your data.

At the end of the process, you can go back to Bonita Portal and start the application again. The option to change Trello API credentials will be displayed.

Set Users in a Call Activity / Subprocess

The task “Set up your account” is called a “Call activity”. In Bonita BPM, this is the way to start a subprocess. Subprocesses can be in the same diagram or in a separate pool as in the Trello Application example. You can of course, create subprocesses in a separate diagram.

In this case, we want the subprocess (“Set up your Trello account”) to be started by the main process (Retrieve board data from Trello). Once deployed in Bonita BPM Portal, we would like the users to see and only be able to start the main process. We don’t want a user to be able to start the subprocess by itself, once it is deployed in Bonita BPM Portal.
The best practice is:

  • Select the main process Pool, and in “General / Actors”, add a user and set it as the initiator. In this way, users can start the main process.

  • Create your second Pool, give it a name, and draw the steps. Next, select the Call to action step in the main process (“Set up your account”) and in “Subprocess Name”, click on the list and select the process to start (“Set up your Trello account”)
  • If you leave “Version” empty, Bonita BPM Engine will always use the latest available version of the subprocess . This is useful when you make changes to the subprocess only: you won’t have to deploy the main process too. But if needed, you can set the version of the subprocess.

  • Next, select the second pool, and in “General / Actors”, add a user. Don’t set it as Initiator: in this way, the process can be only started programmatically. In this example, the “Call Activity” step in the main process will start it.

In order to import the application into Bonita  Portal to check what you see, in Bonita Studio click on the menu “Server / Build”. Next, select the process you want to build, and click on “Finish”. In this example, you will get two files, one per Pool. In the Bonita Portal, import the subprocess first, and then the main process. Once user rights are set and are enabled, you should only see  the “Retrieve Board data from Trello” in the User view.

Resources

All resources used in this article are available on our Github repository:
https://github.com/Bonitasoft-Community/Trello-connector

The Trello connector and application was developed by our consultant Pablo Alonso de Linaje, and fine-tuned by Antoine Thomas for this article. Some variables or comments in code may be in Spanish, as Pablo cames from Spain.