Copy a Case into a New Work Context¶
Goal¶
Create a separate case from the current case and link the copy back to its source.
What You Will Learn¶
- copy a case within the current channel or into another channel
- customize the copied case without changing the source
- preserve traceability between the two cases
Difficulty and Estimated Time¶
- Difficulty: Advanced
- Estimated time: 20 minutes
Assumed Knowledge¶
You should be familiar with channels, case profiles, case links, and retry-safe postwork design.
Required Reading¶
Prerequisites¶
- a case-related process with a case-handling task
- an optional
Copy/TargetChannelIdfield populated from approved channels - permission to create cases in the destination channel
Steps¶
Add this postwork script to the task that confirms the copy:
1 2 3 4 5 | |
Leaving TargetChannelId empty creates the copy in the current channel. Supplying an approved channel ID creates it in that destination instead.
How It Works¶
Copy clones the case and returns the new case instance. Subsequent property changes therefore affect the copy rather than the source. AddLink makes the relationship discoverable without relying only on a subject prefix.
Verify the Result¶
Confirm that a new case is created, its subject starts with Follow-up:, and the source remains unchanged. Verify the relationship and destination channel. Exercise the task only once unless duplicate prevention has been implemented.
Failure and Edge Cases¶
- Retried postwork can create multiple copies.
- The case profile can contain data that is inappropriate for the destination audience.
- Destination-specific content types or related processes may not match the source channel.
Security and Portability Notes¶
- Review copied profile data before allowing cross-channel copies.
- Validate the destination against an allowlist and enforce create permission.
- Store the created case ID in process data when the operation must be idempotent.