Llamachant Workflow Service (Paid Module – Contact Us)

Introduction

After working with the Windows Workflow Foundation services, we realized it is overly complex for our needs. In its place, we decided to implement our own workflow service in an easy to use module that does not rely on Windows Workflow and doesn’t need to be re-created for every solution we design. Meet, the Llamachant Workflow Service.  This is a paid module – to purchase it, contact us.

Primary Uses

The service has a few fundamental uses:

  • Send Emails
  • Send Reports
  • Invoke Methods on Business Objects

All activated either on a schedule, when actions are executed, when objects are first created or when individual objects satisfy some criteria.

Creating a simple workflow definition

 

How we use it…

If you are one of our existing clients, you will have had interactions with the workflow service already. Every week, on Monday morning at 8am Eastern Time, we send out an Hours Summary to all clients that we logged hours with the week before. That email contains a report that outlines all work provided and estimated invoice amount. Internally, the workflow service sends an update email to ourselves showing our progress with client projects. We use it to notify ourselves and our clients of expiring contracts, overdue invoices, received payment notifications, and much more.

How our clients use it…

We have implemented the workflow service in quite a few solutions for our clients. Some usage highlights include sending post-support surveys, downloading statistics from a central distribution service into an XAF based CRM, automatically generating quotes for sales teams, controlling the flow of work orders, and notifying clients of upcoming product updates.

Usage Limitations

  • Before purchasing these modules, you must have a valid DevExpress Universal Subscription.
  • These modules are provided as-is
  • These modules are built using XPO and are NOT Entity Framework friendly

Module Installation

Once purchased, you can download the LlamachantWorkflow installer and include the module in your XAF application as you would with any other module via the Module Designer. Once added to your application, a new Workflow navigation group will be available.


Navigation Group

 

Service Installation

This is a Windows Service. You must use the installutil.exe that comes with the .Net Framework to install the service on a Windows computer of your choice. You should only have one server running the workflow service at any time.

  • Copy the output of the Release folder from the LlamaFrameworkWorkflowService to the Windows computer that will be running the service (Example: C:\Program Files (x86)\LLAMACHANT TECHNOLOGY LTD\LlamachantWorkflowService\)
    • First Time Only: Install the application as a service by opening a command prompt as an administrator. Use the InstallUtil.exe from the .Net Framework to perform the install: (Example: C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe -i “C:\Program Files (x86)\LLAMACHANT TECHNOLOGY LTD\LlamachantWorkflowService\LlamaFrameworkWorkflowService.exe”)
    • Once the service is installed, you can manage it like any other Windows service using the Services Control Panel (services.msc)
  • Copy the output of your Win or Web application to the Assemblies folder within the service installation directory (Example: C:\Program Files (x86)\LLAMACHANT TECHNOLOGY LTD\LlamachantWorkflowService\Assemblies\YourProductName\)
  • Edit the LlamaFrameworkWorkflowService.exe.config and set the ConnectionString to your application’s database
  • Change the LogDirectory as desired. This is where all logs for the service will be stored
  • Start the workflow service using the Services Control Panel (services.msc) or via an Administrative Command Line (Example: net start LlamaFrameworkWorkflowService)

Application Updates

When you create a new version of your application, it is a good idea to update your assemblies in the Workflow Service as well.

  • Stop the workflow service using the Services Control Panel (services.msc) or via an Administrative Command Line Example: net stop LlamaFrameworkWorkflowService)
  • Replace the assemblies in the Assemblies directory (Example: C:\Program Files (x86)\LLAMACHANT TECHNOLOGY LTD\LlamachantWorkflowService\Assemblies\YourProductName\)
  • If changing versions of the DevExpress tools, ensure all previous versions of the same assemblies are removed
  • Start the service using the Services Control Panel (services.msc) or via an Administrative Command Line (Example: net start LlamaFrameworkWorkflowService)
  • Note: It’s a good idea to keep the DevExpress references in the Workflow Service the same as the version in your application.

Troubleshooting

  • Always check the Log files located in the directory specified in the LlamaframeworkWorkflowService.exe.config file
  • If a log is not created, check the Windows Event Viewer
  • It is normal to receive messages like “Could not find assembly DevExpress.Persistent…..vXX.X” when the version is older than the version you are currently targeting and Assembly Binding Redirection is specified in your config file
  • If you receive errors when preloading assemblies, set the PreloadAssemblies option to False in the config file

 

Using the Modules

Workflow Settings

An Administrator should setup the Workflow Settings to enable mail to be sent through an SMTP server. Once configured, mail will be sent on your behalf using these settings. Use the Test Settings action to send a date/time stamped email to an email address of your choosing.

Workflow Settings View

 

Workflow Email Templates

Create useful email templates and embed data from your objects directly into the subject and body. The simple example below includes the First Name field from the Client object. You can also include a chain of properties such as {Address.State.Name}. All emails are sent as HTML so you can get creative and create truly stunning email templates.

Workflow Definitions

It’s important to setup your workflow definitions carefully. A definition that is setup incorrectly could have consequences (such as over-emailing or incorrectly editing data). Ensure you have filled in all appropriate details before activating the workflow.


Creating a workflow definition

Specify a name, frequency, interval (if required) and then select the actions the workflow should take. The Frequency determines when the workflow should be evaluated next. If it’s time based (Minutes, Hourly, Daily, Weekly, Monthly) then the Interval field will be available. Specify the number of minutes, hours, etc. before the workflow should be run again. Once run, the Next Run Date will be set to the next interval. If the workflow is setup as One Time, it will be evaluated and run once for each targeted object. There are 2 other frequencies that can be selected, On action executed and Always. The On action executed option will allow a workflow instance to be created and processed when a user executes an action. You can use a pre-defined action or include a caption for your action and a new Workflow action will be added automatically for the user to select. Finally, the Always option is evaluated on every iteration of the workflow service (30 seconds by default). Once an object meets certain criteria, it will be evaluated and you should plan to affect the object so it no longer meets the criteria on the next iteration.

A – Run this workflow against individual objects

This option allows you to specify a Target Object Type and provide some criteria that the object must match in order to be considered when evaluating the workflow. Use the Show Current Results to see all items that can be run with the workflow. Note that depending on the frequency, you may see more items listed than what will actually be processed. This is because the workflow server checks to see if the workflow has been run against an object previously before processing it again.

B – Invoke a Method

You can invoke a method on your business object. Specify the method name that should be called. Please note that your method cannot contain any parameters. You can optionally return a bool value which will be considered during the workflow evaluation. If a false value is returned, the workflow is cancelled and will be re-evaluated on the next iteration. If any other return type is provided, the value is ignored.

C – Send an Email

Select an Email Template to send to the recipient. If a Target Object Type is selected, the current object being evaluated will be used as a data source for the email template. Next, provide a static email address or the Email Property Path within the target object. We recommend including criteria to load objects with an email address already specified to limit the amount of objects being processed by the workflow server.

D – Attach a Report

Along with your email, you can optionally send a report. This report is exported and attached as a PDF or Excel document (xls or xlsx). Select a report and, if necessary, select a Report Data Source. This is a property within your business object that should be used as the report data source. Finally, specify a report name without extension. The extension will automatically be applied to the end of the report name. You can include a property place holder in the report name if desired (Example: Invoice for {LastName} )

E – Instances

Once your workflow has been Activated, instances will be displayed in the grid below. This will display the status and/or any errors that may have occurred with a workflow instance.

 

Sample Scenarios

Welcome Email

When you only ever want to run a workflow on an object once, select the One Time frequency in the definition. Select a Target Object Type and apply criteria as required. Once a Workflow Instance has been created for an object, it will not be evaluated again.

 

Send a Report on a schedule

Select the time-based frequency and interval you want to send the report on. Set the Next Run Date to when you want the first report to be sent. Select Send an Email and then Attach a Report. Fill in the options for your email and your report. Note that the Report Data Source option is not available for scheduled reports because they are not run on a particular object. Instead, the report’s data source will be used as if you were running it from the Reports module of your application. It is recommended that you remove all parameters from your report or provide default values as the workflow service is incapable of setting parameters.

 

Update an Object

When an object sits in a current state, it often makes sense to move it into a new state. You can use the State Machine module provided by DevExpress if you want the user to work with these states within the UI. In many cases, we implement our own pre-defined states without using this module using controllers and actions instead. If you want the workflow service to change the state for you, setup a new workflow definition and set the Frequency to Always. Select Run this workflow against individual objects and provide criteria that identified an object as being in that state. Select Invoke a Method and enter the method on your business object that will move your object from its current state into a new state. If desired, you can send an email and report as well if it’s appropriate.

File Type : PDF

View / Download