Toggle menu

Creating Custom Tasks

Introduction

Tasks are jobs assigned to users during the lifetime of a case. They are a formal piece of work that needs to be completed and recorded as part of resolving the case.

We've created a range of standard tasks, but it's also possible to design your own. Any form can be integrated with a case and turned into a task form by adding some form snippets to it.

This article describes using the "multipurpose" task snippets to create a custom task. It will use a single form, assigned to another user, which they must fill out to complete the task.

You can also create custom task workflows to create more complex tasks that have multiple stages.

What is a Task?

A task is generated during a case, either automatically when the case starts, or created manually by the case manager.

A task can be assigned to a user, or created for one of a group of users to claim.

Tasks will typically involve the assigned user filling out a form which, when submitted, passes data back to the parent case. When this form is filled out, the task is complete.

Design a Task Form

You can turn any form into a task form.

Your form must be named following the Form Language and Version Numbering convention - that means the name of your form should end with V1EN or V1CY.

The example form below is part of an allotment management process. It is used once a request has been made to put up a new shed. The case manager will assign the task (form) to the grounds team, who will inspect the site, assess the shed, then complete the form.

Task Form - Allotment

Once you are happy with your form, it needs to be integrated with Case Management.

Add the Start Snippet

Add the "CM Multipurpose Start" snippet to the top of the first page of your form. There's no need to edit any of the fields.

Multipurpose Snippet Toolbox

Multipurpose Snippet Start

Advanced Feature - Case Process Variables

The snippet includes a caseProcessVars variable field. The field's default function is used to fetch process variables from the parent case that the task is started from. The limitTo array lets you enter the names of process variables that you would like to be available in your task. Do not leave this array blank or all variables will be retrieved. For example:

{
    processName: 'casemanagementv1',
    businessKey: helper.queryFieldValue('CASEBUSINESSKEY'),
    limitTo: ['form_SITE']
}

The variables you request are returned in a server-side form variable:

caseProcessVars = {
    "form_SITE": "Plymouth"
}
Which could be used in the default functions of other fields on your page:

Get Value of Task Variable

function(helper, defaultValue, currentValue) {
    var theValue;
    if (currentValue !== undefined) {
        theValue = currentValue;
    } else {
        theValue = helper.getVariable('caseProcessVars.form_SITE');
    }
    return theValue;
}

Add the End Snippet

Add the "CM Multipurpose End" snippet to the bottom of the final page of your form. It includes all of the buttons you'll need.

Multipurpose Snippet Toolbox

Multipurpose Snippet End

Cancel buttons

The snippet includes logic to be able to cancel the task. This is only available to the user who created the task.

When a user presses the Cancel button, the snippet displays the confirmation buttons. You need to add logic to your form to hide the confirmation buttons until the Cancel button is pressed.

In the page settings, open the Client Init Handler:

Page Settings - Client Init Handler

And add the following to hide the CONFIRMCANCELLAYOUT and all of its fields:

Hide CONFIRMCANCELLAYOUT

Create a Read-only Summary

In the "Form settings" section of the Forms designer, create a "Custom Read Only" template. This is the view of the form that will be used when the task is viewed by a user, using the "View" link on the case task tab, and by templates like Self Service and User Requests.

Readonly Template

You can use the default summary as a starting point:

Handlebars Template Editor Summaries

At the very least you will need to delete the sections at the top and bottom of the default summary that relate to the start and end snippets.

There's more information about Handlebars templates in the Handlebars Editors documentation.

Configuring a Task for a Case

Now that you have your task form you need to make the task available to your case type.

  1. In the Configuration Manager, find the case you'd like to add the task to
  2. Open the "Tasks" configuration
  3. Choose "Add existing task"
  4. Pick "multipurpose" from the drop-down and "add selected task to case type"
  5. Enter a meaningful task name that will be visible in Case Management
  6. Choose the SLA and assignment options
  7. All tasks start the "cmmultipurposev1" workflow and use the "CASEMANAGEMENTMULTIPURPOSEENQUIRYVIEW" form for their read-only modes so these options are prefilled
  8. Check your options and submit
  9. Enter the name of your task form (created above) on the final page

Self Service Article Extras

So that users can claim and work on your task, any articles that use the Self Service or User Request templates will need to be updated.

The "CM Multipurpose Start" snippet starts a workflow process called "Multipurpose Task". Pick that workflow process in the article extras of your Self Service template so users can claim and carry out your custom task:

Multipurpose Self Service

Using your Task

Now that your task has been configured it will be available to case managers in the Tasks tab:

Create Task

The task behaves exactly like any other. See Case Tasks for more information.

Last modified on January 24, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon