Skip to content

Assign a Case and Set Its Deadline

Goal

Assign the current case to a responsible group and set a deadline from a case-related workflow task.

What You Will Learn

  • resolve an assignee without embedding an environment-specific identifier
  • assign the current case with an audit comment
  • calculate and set a case deadline

Difficulty and Estimated Time

  • Difficulty: Beginner
  • Estimated time: 15 minutes

Assumed Knowledge

You should be familiar with cases, channels, related processes, prework scripts, and group identities.

Required Reading

Prerequisites

  • a group named Case Reviewers in the test domain
  • a process configured as a related process of a case-enabled channel
  • a task marked as a case handler

Steps

Add the Assignment Script

Open the prework script of the case-handling task and add:

1
2
3
4
5
6
7
8
var reviewerGroup = $Membership.FindIdentity('Case Reviewers');

if (!reviewerGroup) {
    throw new Error('Case Reviewers group was not found.');
}

$Case.Assign(reviewerGroup, 'Assigned by the case review workflow.');
$Case.DeadlineAt = $Calendar.AddDays($WorkItem.Start, 2);

Use a dedicated group created for the tutorial. Replace the group name only when your domain uses a different configuration; do not replace it with a copied identity identifier.

  1. Create a case in the test channel.
  2. Start the related process from the case.
  3. Open the case details after the case-handling task starts.

How It Works

$Case resolves the case that started the related process. Assign records the new identity and the supplied audit comment. DeadlineAt stores the calculated date on the same case.

Verify the Result

Confirm that the case is assigned to Case Reviewers and that its deadline is two days after the task start time. Remove or rename the group and repeat the test to confirm that the script fails before changing the case.

Failure and Edge Cases

  • $Case is unavailable when the process was not started in a case context.
  • Identity names must resolve unambiguously in the current domain.
  • Calendar and time-zone rules can change the effective deadline.

Security and Portability Notes

  • Assign only to identities that are allowed to view the channel and case.
  • Resolve identities in the current domain instead of storing tenant-specific GUIDs.
  • Keep assignment comments free of secrets and unnecessary personal data.

What to Learn Next