Workflows with Azure Logic Apps and Time Cockpit

Tuesday, February 28, 2017 by Rainer Stropek

More and more of our customers use multiple SaaS solutions to do their business. Many of their business processes span multiple applications. Therefore, they need a glue that combines the different systems. One possibility is writing serverless functions. We wrote about that approach in our blog post Azure Functions - Seamlessly Connecting Time Cockpit. However, sometimes graphical workflows are a better match. Azure Logic Apps implement such an approach. In this blog post we demonstrate how you can embed time cockpit in such workflows.

Please note: Don't expect Azure Logic Apps to be a fully fledged business process management system like FireStart. They are just a convenient way of putting together simple, automated workflows that involve multiple SaaS solutions.

Getting Started

If you want to create a logic app, you will need an Azure subscription. Next, you should create a Resource Group (RG). The RG a container with which you can group logically connected pieces of code (e.g. Azure Functions) and workflows (Logic Apps). Once you have a RG, you can create a logic app:

Building Logic Apps

Once your Logic App has been created, you can start designing the workflow. The nice thing with Azure Logic Apps is that they come with a large number of pre-built connectors to systems like:

  • Office 365
  • Slack
  • Salesforce
  • Mailchimp
  • BizTalk
  • DropBox
  • OneDrive

Microsoft has a complete list of connectors in the Azure Documentation. Beside the standard connectors, Logic Apps can also communicate with systems using RESTful Web APIs, service bus solutions, etc.

Time cockpit comes with a RESTful Web API (OData) and can therefore be part of Azure Logic Apps workflows.

The image at the beginning of this blog post is a sample workflow combining the calendar of Office 365, Slack and time cockpit. The workflow is triggered whenever a new appointment is created in Office 365. It checks whether the subject starts with "tc:". If it does, it uses time cockpit's OData Web API to create a new time sheet record with the data from the appointment. Last but not least it posts a message into Slack to inform the user what it has done.

Time Cockpit OData Requests

In Logic Apps, you can build properties based on results of previous steps in your workflow. In our case, we insert data from Outlook's appointment into our OData request for time cockpit:

Show Me the Code

If you are a developer, you might prefer code over a graphical workflow designer. The good news is that Azure Logic Apps give you the choice. You can switch between a code view (JSON) and the designer. Of course you can also check-in the code into your source control system (e.g. VSTS, GitHub).

You can learn more about Logic Apps' Workflow Definition Language in Azure's documentation.

Recommendations

So you never have to write code again if you want to integrate time cockpit with other system? Unfortunately this is not the case. We recommend considering Logic Apps if the following statements are true:

  • Logic Apps has a ready-made connector that makes you more productive because you do not have to write the integration code yourself.
  • Your workflow is rather simple and basically just gets data from one system and writes it to another system.

We do not recommend to implement complex business logic in Logic Apps workflows. You should use Azure Functions or other web APIs to encapsulate business logic. Of course you can call these APIs from your Logic Apps workflows.

Have fun desiging your processes with Logic Apps and time cockpit! Problems or questions? Don't hesitate to contact us.

comments powered by Disqus