Instant Gratification with Flowable 6

blogger2“Ok, so there’s a download of Flowable 6 available, meaning I don’t need to checkout and build from source, but you know what, I’ve still only got a few minutes to see if it’s worth investing more time.”

I know your time is valuable, so here’s a really quick run through you can follow with the download, and hopefully it’ll persuade you it is worth investing more into the very cool technology underneath. I’m going to make it techie light, so any interested user can also get a feeling for it too.

Already downloaded the latest Version 6 zip file? Ok, when it’s unzipped, the only thing we’re interested with today is the ‘wars’ folder. If you already know what to do with these, then don’t let me stop you, and jump to the next paragraph. If not, I’d recommend using the latest stable Tomcat for your operating system (http://tomcat.apache.org/download-80.cgi) and all you need to download is the zip version of the Core. Unzip that Tomcat somewhere on your machine and browse the unzipped folder. You should find a ‘webapps’ folder – and this is where you need to copy all the “WAR” files files from the Flowable ‘wars’ folder. Once all the .war files are in webapps, navigate to the ‘bin’ folder in Tomcat and start ‘startup.bat’ if you’re on Windows, or ‘startup.sh’ on Mac or Linux. If startup.sh doesn’t start, you may need to make it executable. Google is your friend.

Getting started

Hopefully, you have all those lovely Flowable webapps running in Tomcat now, so we can start up the user interface.  We’ll begin with the Task interface, so fire up your fav browser, navigate to http://localhost:8080/flowable-task and you should see the login screen below.

Login with the user admin and password test and you’ll be taken to your tasks homepage.  At the moment it will look a bit of a lonely place, with just one App – the general Task App that gives you access to all tasks across all Flowable process apps.

f6s2

Click into the Task App to see a list of tasks assigned to you (Tasks page), or processes (Processes page) you’ve started. Not surprisingly, both are currently empty, so let’s add an ad hoc task by clicking the Create Task button.

Fill in some details and create the task. The task will be assigned to you by default, so you’ll now see the new task in your Tasks list. The currently selected task’s details are shown as well, but again, there’s very little to see here at the moment.

If you’re bored, you could just click the Complete button and feel a certain pride in finishing another job. It might be more interesting if you were to do some additional things to the task. If there were other users in the system, you could click on the Assignee to pass the task onto them, but there’s only the one user at the moment. You can set a due date – just click on No due date and select a date from the calendar.

Fine, you say, what else? Well, try adding a file to the task and a comment. You use this when you want to attach some documents, images or videos that may help the person working on the task. Also, comments are a good way of communicating with other people if you involved them in working on the task.

Talking to yourself isn’t healthy, so we need to start working with more people. We need a little scenario to build out our example, so let’s imagine there’s an awesome band called the Flow Pistols, with band members Joram Rotten, Tijs Vicious, Yvo Jones and Paul Cork, who will have gigs around the globe, albums to record in studios and TVs to throw out of hotel windows. Their manager is Malcolm Mysterious. We’ll create a simple process to help them manage themselves better.

Add and manage users

It’s the time for us to jump to another Flowable interface to create new users, groups and privileges. Open a new tab or window in your browser and navigate to http://localhost:8080/flowable-idm (noticing that you didn’t need to login because you’d already logged in to the Tasks interface). There are 3 pages in the IDM (IDentity Management) interface and you land on the User page first, so let’s create some users.

f6s7

Just keep adding all of the band members as users. Remember to add Malcolm as well.

It will also be useful to manage the band as a group, so switch to the Groups page and create a new group.

f6s9

With a new group, there are no members showing in the list. If there was, the search box would allow you to filter the list to check membership. To add a user to the group, click + add user, and a popup search provides a way for you to search for a user to add. Currently, the search is case sensitive, so to find Joram to add, enter ‘J’ or any group of letters, like ‘ram’ or ‘Rot’. Add the four band members: Joram, Tijs, Yvo and Paul.

Next we need to give the right access privileges to the different users. Switch to the Privileges page and add Malcolm as a user in all the privilege groups, so he can have full control over new users and administering the system (well, he is a control freak).

For the rest of the band, he only wants them to have access to the Task interface, so add the Flow Pistols group to the workflow application privilege.

Design the process

Now it’s time to define the process. We’ll keep it simple as a first attempt. To design a process you need to have the modeler privilege, which gives us a chance to test the privileges by signing off as admin and signing in as malcolm to the Modeler interface (http://localhost:8080/flowable-modeler). After signing in, you’ll be taken to the Process page and need to click Create process to get started. Fill in some details, including a unique key as an identifier for the model.

f6s13

You’ll be taken directly into the process design interface, with a palette of BPMN 2.0 elements on the left-hand side. There’s a panel in the bottom part of the page with all the properties for the model. This panel gets updated with the properties of whatever has been selected in the process canvas. Which takes us to the design canvas – with a new process, a Start event element is already there, represented as a small circle.

You can design the process by dragging and dropping elements from the palette on the left, or you can use the “quick menu” of a selected element on the canvas. I find the quick menu the quickest (why would that be?), so that’s the approach I’m going to use. Click on the start event on the canvas and its quick menu will become visible. We’re going to add a User Task next, so click the icon representing a user.

f6s15

This should add a box linked by an arrow to the start event. Double-click on the box to give the task the name Choose gig location and click outside the box to save the change. Click on the box again to display its quick menu and select the Gateway icon (a diamond containing x).

f6s16

This adds an exclusive gateway after the task. If you wanted it to be an inclusive or parallel gateway you could click the spanner icon on the quick menu to change the type of gateway, but leave it for now. After the gateway we’re going to add another task for a person, so click the User Task icon.

f6s17

Name the new task Book stadium sound system and drag the bend in the connecting arrow to above the gateway by moving the mouse over the connector and grabbing the red dot that appears on the bend.

f6s18

Click on the gateway element and click the User Task icon again. This adds another task connected to the gateway. Name it Book transport for bandgear and lay it out to make the process diagram nice and clear.

f6s19

Click on the last task and select the Gateway icon. This will add another gateway, and before doing anything else, just quickly click the Stop event icon on its quick menu (circle with a thick border).

f6s20

Now we need to connect the “stadium” user task to this gateway, which we can do using the Connector icon on its quick menu. Click on it and drag the mouse over to the last gateway and release to complete the connection.

f6s21

The connector is straight, so here’s a chance to see how we can add (or remove) bends to lay it out as we wish. The “bend” edit icons are in the toolbar.

f6s22

Click the + bend icon to switch into bend edit mode.

f6s23

Click on the connector where we want to add the bend and a red dot will appear, which can then be dragged to create a more pleasing layout.

f6s24

This gives us the overall process we want to use, so now let’s add some forms to the user tasks to collect data that we need as part of the process

Draw some data collection forms

There’s a couple of ways you can define forms. One is to go to the Forms page in the Modeler interface and just create form models, then link them to the process. Alternatively, you can create them within the process model automatically linked (and they’ll also show on the Forms page). You can add forms to User Tasks and Start Events by selecting the element and clicking their Referenced form property. This pops up a large dialog with options to select and open an existing form, or create a new one. Let’s get going with the process for the Flow Pistols, by selecting the Start Event and clicking its Referenced form property, then click the New form button and complete the details to create a form, including a unique form key identifier.

f6s27

This will now take you into the Form designer, with form components on the left-hand side that can be dragged onto the design canvas. The only data we want to collect when a process is started is in which part of the world the gig will take place. We can do this by using a dropdown field, so drag and drop the Dropdown element from the palette on the left to the design canvas.

It will be given a default name of “Label”, which isn’t too informative, so to change it, hover your mouse over the dropdown field on the canvas and an edit button (pencil) will appear. Click on this to edit the settings for this field. Give the field the label Continent and you’ll also see it give an Id (identifier) of continent, which is the reference we’ll use to refer to this field later. It’s also possible to define your own identifier. You can also mark a field as Required, meaning the form won’t complete unless a value is given.

f6s29

We want to define the values for the dropdown menu, so click on the Options tab and add Europe, The Americas and Asia.

f6s30

Close the field edit dialog and then save the form. You’ll be taken back to the process designer.

Next, select the Choose gig location user task and click its Referenced form property. Again, click New form and get taken to the form designer. This time, drag an Expression field onto the canvas, followed by a Text field, then a Date field and finally a Number field. We’re going to use the Expression field to give some relevant information to the person who will complete the form. Edit the Expression field and enter the text “Please choose the city and audience size for this gig in ${continent}…”. As you may have guessed, the value selected in the initial form for the Continent field will be substituted in the text.

f6s31

Edit the Text field and give it the label City; likewise, label the Date field as Date and Number field as Size (k) (its identifier will be sizek). You should now have a form that looks something like the following.

f6s32

Finally, add new forms for the two booking user tasks. Add an Expression field and Text field for each, edit the Expression field and give it an expression like
“Please arrange the stadium sound system for the tour in ${continent} on ${date} in ${city} and enter the reference …”, and give the Text field a label like “Stadium booking reference”. Do I need to say change the text and label as appropriate for the Booking transport for the band’s own gear task?

f6s51

We now have tasks and forms to collect data as we go through the process, but who’s responsible for doing what? Responsibility isn’t a word that’s familiar to rock stars like the Flow Pistols, but efficient processes means saving costs, which means more cash in the pockets of our rockers to spend on their outrageous lifestyle. Let’s define who does what.

Assign tasks to people

Responsibility for a task is defined by setting its assignment. You can do this by selecting a User Task and clicking its Assignments property. A dialog pops up that allows you to choose whether the assignee should be a single person (it can be a named user, or simply the person that started the process); a list of candidate users; or, one or more candidate groups. If a task is assigned to a list of candidates or groups, then someone from the list or group has to claim the task to work on it – it then becomes directly assigned to them for that specific task in that specific instance of the process.

Let’s add some assignments. Select the Choose gig location user task and click its Assignments property. In the dialog that pops up, select Assigned to process initiator leaving the Type as Identity store.

f6s34

Whoever starts the process will now get the Choose gig location task assigned directly to themselves. However, for booking the stadium gear, Malcolm is the only person with the knowledge and appropriate responsibility to do it. Select the stadium booking task and click its Assignments property. This time, select Assigned to single user and type “M” into the search box that appears. This will show a list of all users in the identity store that contain “M”, which includes Malcolm in this case, so pick his name.

f6s35

When it comes to booking transport for the band’s own gear, we’re happy to let anyone in the band organize that. Select the booking transport task and click its Assignments property. Select Candidate groups, type “F” in the search box and pick the Flow Pistols group. We’ll also let anyone complete this task if they started the process, so turn on that option. This means that Malcolm can do the task, even though he’s not a member of the Flow Pistols group.

f6s36

Nearly done on the process. The final thing to describe is when to take which of the different paths that are possible.

Define flow conditions

We have a choice of two paths through the process, so next we can define the conditions for taking one route or the other. Double-click on the connector going into the “stadium” task and give it the name Over 2k to help anyone looking at the diagram.

f6s25

However, to actually define the condition we need to select the connector and click on the Flow condition property in the panel at the bottom. This opens a dialog where you can enter the expression that will be evaluated for a process to take that path. We want to follow the stadium path when there’s more than 2000 fans expected in the audience, so enter the expression ${sizek > 2}. We want the flow to go to organizing the band’s own gear in all other cases, so if we select that flow connector we can mark it as the Default flow in its properties.

f6s26

It’s also sensible to review the order in which the flow conditions are evaluated. The initial flow order is the order in which the conditions are defined. If that’s the order you need, you’re fine; if all your conditions are mutually exclusive, the order shouldn’t matter. Just to be sure, you can select the gateway element itself and click on the Flow order property, which allows you to reorder the conditions. It’s always worthwhile checking flow order if you have a connector without an explicit condition.

f6s50

That’s it: process defined! We rock! However, before we can use it, we need to publish the process and all its components as a Process App. Switch to the Apps page in the Modeler to create our first app.

Create a Process App

Once we have one or more processes designed, we can make them available for people to use. Typically, processes are grouped together either by who is going to use them or how they’re going to be used. You might put all your Human Resources processes in one process app, for example. We’re just going to have one process to begin with, so first click the Create app button on the Apps page, giving it a name, unique key and description.

f6s37

We’ll then get taken to the App editing view where we can pick an app icon and theme to help distinguish it from other apps. We also need to add our process to the list of models in the app, so click the Edit included models button. You’ll be shown a list of all the process models available and can select one or more to be included: select the process we just defined.

Save the app model and we have our first app defined, but still not quite ready to be used. To make an app available for use, it meeds to be “published’, and everytime changes are made to any part of the process or forms, you will need to publish the app again to make those changes live. If you were sharp-eyed you will have noticed an option to publish on the Save App dialog. You can publish an app at anytime from its details view. Select our app from the Apps page and you’ll be taken to the details view. You’ll see a bunch of actions you can take from the toolbar, including Publish. Click that now.

We’ve finally got to the point where we can use our new process. We mega rock!

Starting your first process

To start processes and view tasks, we need to use the Task interface again. Staying logged in as Malcolm, switch to http://localhost:8080/flowable-task. If you’re on the home page you’ll see the new Gig App (if not, click on the top left Flowable logo to get there), so click the Gig App to work with all tasks and processes associated with it.

If you go into the generic Task App then you can see and work on all tasks and processes for all the apps available to you.  Once in the Gig App task view, there’s a help bubble with an option to start a new process.

f6s40

If you have tasks still active and no help bubble, you can also start a process by going to the Processes page. Whichever way you go, you’ll then get presented with a list of processes available within that process App. There’s only one for us to pick, and we’ll see its start form ready for us to pick a continent. Select a continent and click the Start process button.

You’ll then be taken to the details view for the just created instance of the process. Here, you can see what tasks have been completed, what tasks are active and a graphical diagram of the process with its current state.

Switch to the Tasks page and you should see a Choose gig location task for you (as you were the process initiator). Enter an city and date, plus an audience size greater than 2k, for example 50, then click the Complete button.

The view will switch to a Book stadium task, because the last task was completed and almost immediately a new task added to the top of your task list. Remember, only Malcolm will get assigned this task, so you need to be logged in as him to see it. Type some value for the booking reference and click the Complete button.

There we go, we’ve finished our first run of our process, and no animals or children were harmed, no public offended.

Taking a different path

Let’s create another instance of the process and take the alternative route using a different user.  Sign out using the menu on the user’s name in the top right corner and then login using paul with the password you gave the user Paul Cork.  Start a new instance of the process from the Gig App, but this time, give an audience size of 2 in the start form.

On the Tasks page, you may be surprised to see nothing. That’s because the task list shows tasks directly assigned to the user, but this can be changed by clicking the filter area at the top of the task list. Select the filter option Assignment and set it to Tasks where I am one of the candidates.

The task list should now show a task to book the transport, but before you can work on it, you need to get it assigned directly to yourself. Otherwise, it’s like its just sitting in a queue of tasks for the band, waiting for someone to take ownership, or work through the other queued tasks.

Click the Claim button and you’ll now be able to see the task form and complete the task.

Dude, we’re nearly done.

Looking at completed processes

You can look at what was entered in tasks that have been completed by going to the Processes page and changing the list filter to include completed processes. Select the completed instance you’re interested and you’ll see its status view. To look at what data was entered in a form, click one of the completed tasks listed and you’ll be shown the form with the data used.

f6s49

Wrapping up

There we go, Flow Fans, a run through of just a small part of what you can do with Flowable without writing a line of code. Hopefully, it’s given you enough of an introduction for you to go back and explore some of the options I completely ignored and also try your own processes.

And I think you can be sure you haven’t heard the last from the Flow Pistols!

Advertisements

14 Comments

  1. Good One and it helps a lot to someone like me who is a newbie. Many many thanks. Is it possible for you to do some more examples, like how can we get the data values into a form field from another external table. For example, the continents, country and city can all be part of one table. And you choose the continent and it loads the other dropdown fields with county and cities. If possible please try to give me some hint.

    Thank you and your demo here is much appreciated.

  2. Great article for a newbie like me! Thanks!
    A little correction:
    in the first paragraph of “Add and manage users” section, there is a missing colon (“:”) for link “http://localhost:8080/flowable-idm”.

  3. New to the workflow engine world. This is a nice post. It would be nice if you could publish a book about using flowable or add integration examples with services.

  4. Is there a group level ACL respected in Flowable?
    If Paul is not part of the group flowpistols, will he still be able to view tasks of “Book transport for Bandgear”?

  5. Yes. Only individuals or groups assigned to a task can see it. Also, anyone who is “involved” explicitly on a task by any of those people. You can also limit users and groups that have access to processes when you deploy a process app.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s