Skip to content

Track User Performance with Milestones

Scenario

Use this example when a case should measure how long a user takes to complete a process-driven activity. The milestone starts from process logic and is then visible in the case and channel views.

Prerequisites

  • permission to create folders, processes, and channels
  • access to prework and postwork scripts
  • case milestones enabled for the target channel

Steps

Create the Folder and Process

  1. Create an application folder, for example Proposal Process.
  2. Create the process and open it in edit mode.

Build the Process Flow

  1. Rename the opening task to Proposal Form.
  2. Add the Submit action.
  3. Create the approval task with Approve and Reject actions.
  4. Mark the process task that should work with the case as Is Case Handler.

Start the Milestone in Prework

Open the prework of the approval task and add logic like the following:

1
2
var ed = $Calendar.AddDays($WorkItem.Start, 1)
$Case.Milestones.Add('Send Proposal', ed);

This creates a milestone named Send Proposal and sets its due date to one day after the task start time.

Prework script editor used to create the case milestone.

Stop the Milestone in Postwork

Open the postwork of the same task and add logic that stops the active milestone when the process is completed:

1
2
3
4
5
6
7
8
9
var haveActiveMilestone = $Case.Milestones.ToArray().some(function(m)
{
    return m.Name == 'Send Proposal' &&
            (m.Stage == "InProgress" || m.Stage == "Paused");
});

if (haveActiveMilestone) {
    $Case.Milestones.Stop('Send Proposal');
}

This ensures the milestone closes only when the expected case-linked work has actually finished.

Postwork script editor used to stop the active milestone.

Create the Form

  1. Build the proposal form.
  2. Add a text field such as ProposalName.
  3. Add a file field such as ProposalFile.

Create the Channel

  1. Create a new group channel.
  2. Enable cases.
  3. In channel edit, enable milestones and add the new process under Related Processes.

Channel configuration with milestone support and related process setup.

Create the Case and Run the Process

  1. Create a new case in the channel.
  2. Start the related process from the case.
  3. Submit the proposal form.

At this point the milestone is created automatically for the case.

Observe the Milestone Lifecycle

  1. Let the due date pass to see the milestone move into the overdue state.
  2. Review the channel and case screens to confirm the milestone warning and red status.
  3. Complete the approval task to close the milestone.

Overdue milestone warning shown on the case.

Milestone closed after the proposal process is completed.

Result

The case now tracks user performance through a milestone that starts from process logic, becomes overdue when the due date passes, and closes automatically when the work is completed.