Creates a copy of an existing case with a new business key.
The case you'd like to copy can be open or closed. If the original case is already closed, the terminated process instance must still exist in the workflow engine as this is the source of the data for the copy (the default behaviour is for an iCM Scheduled Tasks to delete terminated processes that are over a year old).
Copies can be linked, and it's possible to close both the original and the copy as part of the copying process. Values from the original case can also be overridden.
Note that this function creates a "shallow" copy of a case. The copy only includes:
- case type
- stage
- status
- contact details
- form fields from the original case and additional details form
It does not copy:
- attachments
- emails
- history
- appointments
- tasks
- subscribers
- questions
The copy of the case starts a new workflow process instance with a new business key and a start date of the time the copy was made. As the copy is a new case, emails and notifications will be sent as if the case had been raised normally.
Namespace
goss.CaseManagement.v1.api.copyCase
Worker
serverlibrary
Parameters
Property | Type | Description |
---|---|---|
case | Object, required | Details of the original case |
case.caseId | String, required | The business key of the case to copy |
The following properties are all optional | ||
case.close | Object | This optional property will close the original case and terminate any outstanding tasks |
case.close.closureReason | String | The reason the case is being closed |
case.close.closureNote | String | An additional note that will be added to the case history and email that is sent to the person who raised the case |
user | Object | Details of the user performing the copy. If not supplied the default system users credentials will be used |
user.siteUserName | String | Note that usernames are the account usernames of the relevant website user, which will likely be a GUID |
copiedCase | Object | The properties in this object can override values from the case that is being copied |
copiedCase.ownerUserName | String | The username of the person who raised the case |
copiedCase.caseTypeId | String | The case type ID for the type of case to be created (this is generally the case name in lower case and is set as part of your case configuration) |
copiedCase.caseSubTypeId | String | The case subtype. This must exist in the case configuration |
copiedCase.caseStageId | String | The case stage. This must exist in the case configuration |
copiedCase.caseStatus | String | The case status. This must exist in the case configuration. Only open, in progress and escalated statuses can be set (creating closed cases is described below) |
copiedCase.caseManagerId | String | The username of the case manager (ie the account username, which may be a GUID) the copied case should be assigned to. The case manager must be a member of the relevant case manager group in the case configuration. If not provided, or invalid, the case won't be assigned and will be claimable by anyone in the configured case manager group |
copiedCase.language | String | The language code of the case. Defaults to EN if not set |
copiedCase.targetDate | String (date-time) | The target completion date for the case (the SLA) eg "2022-06-23T09:27:53Z". Must be in the future. If not set a new target SLA will be calculated from the time the copy is made using the SLA for the case type |
copiedCase.contact | Object | Details of the person who raised the case |
copiedCase.contact.name | String | Their full name. Automatically mapped to form_NAME |
copiedCase.contact.email | String (email) | Their email address. Must be in a valid format. Automatically mapped to form_EMAIL |
copiedCase.contact.phoneNumber | String | Their phone number. Automatically mapped to form_PHONENUMBER |
copiedCase.contact.address | String | Their address. Automatically mapped to form_ADDRESSTEXT |
copiedCase.close | Object | If supplied the case will be created then closed |
copiedCase.close.closureReason | String | The reason for the case being closed |
copiedCase.close.closureNote | String | A note that will be added to the case history and the close case email that gets sent to the person who raised the case |
copiedCase.form | Object | This object provides details that would otherwise be provided by a form submission that starts the case. If not supplied the details from the original case are used |
copiedCase.form.startForm | String | The name of the form used to start the case. This form must exist |
copiedCase.form.summaryForm | String | The name of a form to display summary/read-only views of the case. Defaults to the startForm if not set |
linkCase | Object | If set creates a link between the two cases |
linkCase.linkType | String | The type of link to create. Links are defined in the |
Examples
See Case Management API for a full example call.
This first example shows the minimum that needs to be set to copy a case:
{
"case": {
"caseId": "6651-5379-9769-1525"
}
}
This example shows the full parameter structure:
{
"case": {
"caseId": "7078-6032-7376-9241",
"close": {
"closureNote": "Abc",
"closureReason": "Closed"
}
},
"user": {
"siteUserName": "TIMG"
},
"copiedCase": {
"contact": {
"phoneNumber": "01752123456",
"name": "Bill",
"address": "New address",
"email": "support@gossinteractive.com"
},
"language": "CY",
"targetDate": "2022-10-22T11:44:29Z",
"caseStatus": "In progress",
"form": {
"startForm": "ALLOTMENTENQUIRIES",
"summaryForm": "ALLOTMENTENQUIRIES"
},
"close": {
"closureNote": "Abc",
"closureReason": "Closed"
},
"caseSubTypeId": "inspection",
"caseManagerId": "TIMG",
"ownerUserName": "TIMTEST",
"caseStageId": "Stage 1",
"caseTypeId": "newtype"
},
"linkCase": {
"linkType": "Parent Of/Child Of"
}
}
Responses
Success
{
"id": 133,
"result": {
"success": true,
"warnings": [],
"errors": [],
"caseBusinessKey": "7843-2019-5614-1867"
},
"jsonrpc": "2.0"
}
Error Messages
- "Case links have not been enabled"
- "Link type {0} is not configured on this environment - Available types are ({1}}"
- "Could not retrieve case {0}"
- "Process {0} is not a case"
- "User {0} does not exist"
- "Could not write process variables to case {0} during force closure"
- "Could not terminate processes ({0}) during force closure"
Warning Messages
- "No link type provided using default {0}"
- "Could not load tasks from workflow"
- "Original case has already been closed"
- "Could not close case {0} using standard closure attempting to force the closure of the case"