Content Validation Workflow

Content creation workflows requiring complex, possibly incremental, validation steps can be implemented in Cloud CMS. This article describes an approach such a Content Validation Workflow.

There are 3 components to the solution:

  • The workflow process
  • A RESTful service for validating workflow and associated (payload) content
  • Cloud CMS OneTeam User interface customization

Workflow Process:

Include a 'participant' type node in the workflow with a webhook leave handler similar to the following:

    "node1": {
            "type": "participant",
            "title": "Step One",
            "description": "Step One Description",
            "swimlane": "main",
            "transitions": {
                "complete": "complete"
            },
            "handlers": {
                "leave": [{
                    "type": "webhook",
                    "config": {
                        "url": "https://ccms-webhook-server.herokuapp.com/api/taskValidationAlwaysSucceed"
                    }
                }]
            }
        }

The workflow participant node will attempt to transition when the task owner selects the "complete" button from their "tasks" form. The workflow system will then attempt to call the service URL of the  leave handler. If the service returns success then the transition will complete and the next task in the workflow will activate. If the service fails (returns an HTTP code other than 200) then the workflow will not transition from task.

RESTful service:

The webhook from the workflow task is used to call a service which will be passed the context of the workflow (see  workflow documentation). In the workflow node example above the service is located at https://ccms-webhook-server.herokuapp.com/api/taskValidationAlwaysSucceed. This is an example service for testing purposes. This test service's endpoints are listed on github. Source for this test service is available here. In a real implementation the service would parse the POSTed JSON data and perform the validation. If validation passes then service should return HTTP 200. If validation fails the service should return something other than 200 (400 for example).

Cloud CMS OneTeam Customizations

Normally after the service URL of a webhook is called the results (success or fail) are not displayed to the user. A customization is needed to do that. This solution requires such a customization. These OneTeam modifications are packaged into a Require.js compatible AMD module. Modules are discussed in more detail in another knowledge base article.

This customization will detect if the task failed to transition; Indicating a failed validation by the external service. The user could then be visually notified of the failure with an error message.