The Maestro Workflow Engine for Drupal 8 is now available as a Beta download! It has been many months of development to move Maestro out of the D7 environment to a more D8 integrated structure and we think the changes made will benefit both the end user and developer. This post is the first of many on Maestro for D8, which will give an overview of the module and provide a starting point for those regardless of previous Maestro experience.
A very common use-case for Maestro is to launch a workflow in order to moderate some piece of content. You may have an expense form as a content type and you wish to have a manager review and approve it before handing it off to other departments for processing.
This post will show you how to fire off a moderation workflow after saving content with Rules.
Step 1: Create a simple test flow
I know you have a super-ultra-complex workflow, but this is best to get off the ground with a simple 1 step flow for the time being!
Drupal 8 will have web services as part of core which will provide native support for all entity types including custom entity types. Drupal 8 will have support for different serialization formats like HAL+JSON, XML and JSON.
A couple of good article references:
While working on a Drupal Commerce project for a client, which will be handling products and donations will also need to handle conference registrations. There is a commerce_registration module which is looking like a very nice contribution and should work well. The commerce registration module adds a new page to the checkout process for the custom registration fields that are mapped for the selected item being purchased.
We already have the ability to create a drupal action to launch a maestro workflow and trigger that action from drupal. Maesto also has a trigger type task that can launch drupal actions from workflows but we did not have rules integration. We also needed a way to better track adhoc new instances of maestro processes with drupal entities like node and users.
Maestro has a content type task that automatically will create the relationship between the content node and maestro proceess information but there are cases where the maestro content type task is not used to create the content entities and we did not have an easy way to later link maestro processes with content nodes or other entities.
The regenerate functionality goes back many years in the history of the Maestro engine. I wrote the very first instance of the "Maestro" engine back in 2004/2005 where it was nowhere near as flexible and nowhere near as extensible as it is today as Maestro. That being said, the engine's internals have been updated and upgraded over the years which has culminated in what you see today. The concept of regenerate and regenerate all live tasks comes from the very beginning of the engine's life and lives today in Maestro 1.0's engine.
How do I..... ? is a question we hear quite a bit when it comes to the Maestro API. We have a few very good blog posts on our site and also bundle Maestro with some good example code. However time has come to begin to document how to do a variety of common things with the Maestro API.
I'm working on another SQL Server 2008 and Drupal 7 project right now. This particular project has a great deal of stored procedures and triggers in it to massage extrenal data to the right format for display in Drupal.
Doing Drupal/PHP development with SQL Server 2008 is easy using the 2008 Express (free) edition for those of us who don't use SQL Server regularily as a database on our development machines. However, there is one small problem I ran in to on this current project: SQL 2008 Express does not have any UI mechanisms in the SQL Management Studio to allow you to manage triggers!
In part 1 of our Maestro module overview we explained the different task types that we have available in the module. One of these task types is the Interactive Task and this blog post will provide more detail on this task type and how to create your own custom function for it to use. In an interactive workflow driven process, there are many times you need to present information or request information to a user. Examples of this would include:
- Submit a task to a user to create or update a content type record. This may be a drupal article or something more site specific like a job request setup as a custom content type
- Prompt a user to review a piece of information to approve or reject - possibly an article or that job request
- Ask a user for some information using a form - results of which need to be used in the subsequent workflow
- Ask a user to pick from a list of users who should be assigned a subsequent task in the workflow
- Show a user some information - may not require any action
Basically any task where we want to interact with the user and we want full control over what is displayed. We may need to prompt the user with custom submit actions and execute code depending on what action the user takes.
Please note: this blog post refers to Maestro on Drupal 7.
Maestro was a rewrite/refactor of our Nexflow product. When I wrote the first iteration of the Nexflow engine, I always had an Object Oriented approach in mind. While the original Nexflow engine is object oriented, it lacked a clear and clean way to easily implement new features. Although you could easily write a new task type, it was much more difficult to implement in the engine, requiring editing of core code which would always require extensive engine retesting. Maestro Development Methodology:
Our overriding goal was to create a development environment that was suitable for developers to easily attach their own task types and notification mechanisms in to the system without overwriting or hacking core code. Leveraging the strength of Drupal's core functionality along with some neat OO patterns, we were able to create a base set of modules for Maestro that lets developers add their own task types and/or notification mechanisms via add-on modules.
In order to create a Maestro task module, you need to first understand that there are 2 sides of a Maestro Task. There is the User Interface side and the Engine side.
The UI side is responsible for providing the end-to-end user driven experience in creating a workflow using the visual workflow editor. The user interface provides the hooks for showing a task's general display widget as well as its associated editing panel. Without a UI component, users can't use the task in the workflow designer.
The Engine side is responsible for providing the behind-the-scenes worflow engine capabilities that allow Maestro to carry a process forward through the template created by the UI side. The engine side provides all of the necessary logic to execute and complete a task by the Maestro engine.
Maestro is a Drupal 7 module -- meaning that it will not run on Drupal 6. All development for Maestro in terms of its engine must be done on Drupal 7. This blog post is 100% dedicated to showing you how to create a D7 Maestro task module.