Creating a Custom Workflow External Client Application


A workflow external client action application is custom functionality that occurs when a workflow action takes place. There are two ways to implement this feature: as view-only, or as a full plug-in application.

As the name suggests, the view-only approach requires only a view. The external client's URL is specified in the format of xml/custom/views/ExternalAction/{viewName}. The benefit of this approach is easy development, but it requires all application logic to take place in the view. Therefore, this method isn't an ideal development environment.

This topic details the plug-in approach. It uses the same plug-in application framework as other custom Ingeniux CMS applications and provides a complete development environment.

To build an external workflow client application:
  1. Create a controller based on WorkflowClientApplicationController class, making sure to apply all MEF attributes. This controller is available within the CMS installation at [Drive]:\[path-to-CMS-site-instance]\site\App_Data\xml\Custom\SampleApp\Controllers\WorkflowClientController.cs.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.Composition;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using Ingeniux.CMS.Applications;
    
    namespace Ingeniux.CMS.Controller.Custom
    {
    
    	[Export(typeof(CMSControllerBase))]
    	[ExportMetadata("controller", "WorkflowClientController")]
    	[PartCreationPolicy(System.ComponentModel.Composition.CreationPolicy.NonShared)]
    	public class WorkflowClientController : WorkflowClientApplicationController
    	{
    		public ActionResult Index()
    		{
    			using (var session = OpenReadSession())
    			{
    				IPage currentPage = TransitionContext.GetPage(session);
    				ITransition transition = TransitionContext.GetTransition(session);
    				WorkflowContext model = new WorkflowContext
    				{
    					PageId = currentPage?.Id ?? "",
    					PageName = currentPage?.Name ?? "",
    					TransitionId = transition.Id,
    					TransitionName = transition.Name,
    					CurrentUser = TransitionContext.GetCurrentUser(session),
    					ServerUrl = _Common.ServerUrl,
    					AppBaseUrl = TransitionContext.BaseUrl,
    					AppAssetBaseUrl = TransitionContext.AssetBaseUrl
    				};
    
    				return View(model);
    			}
    		}
    	}
    }                             
  2. Build your own index view, or download an example view. Additionally, this view sample is available within the CMS installation at [Drive]:\[path-to-cms-site-instance]\site\App_Data\xml\Custom\SampleApp\Views\WorkflowClient\Index.cshtml.
  3. Start with a strongly-typed view, then comment out the @Model line, if it is not already, before testing and deployment.

This example works the same as the view-only approach. It allows the page name to be changed by using the REST API from the main CMS application to perform the rename. (Depending on your CMS site version, see CMS 10.5 REST API documentation or CMS 10.0-10.3 REST API documentation for more details.) If a user closes the dialog that appears without renaming the page, the page doesn't advance in workflow.

To verify that this workflow application functions as expected, see Testing Workflow Application.

 

This section includes: