Scripts of the type Clone
In the Web Client, a case can be duplicated using the Clone option in the case header.
When a case is cloned, the following data is transferred from the original case:
- case subject
- queue
- assignee (if set)
- values of all case fields (header and Details section)
- main contact
- additional contacts
The following data is not transferred from the original case:
- case history, including comments, emails and attachments
- participants
- related cases or resources
A clone script allows to overwrite this default behavior. You can use it to preset values in the newly created case, similarly to using a default values script. The user can change the values if required.
Steps to use a clone script:
- Write a script of the type Clone on the Scripts page.
- Assign the script to the desired queue. Each queue can only have one clone script.
Coding example
In the following example, the clone script is used to reset the data field Desired deadline to avoid having incorrect deadlines in cloned ServiceDesk cases.
ticket.set("serviceDesk_fields.desiredDeadline", null)
Code example 3: Clone script to reset case field for desired deadline
If the script is assigned to the queue ServiceDesk, the field for the desired deadline is empty in the cloned case instead of containing the deadline from the original case.
Please keep in mind that in a clone script, you do not work in the workflow context. That means the workflowApi object (implementation of WorkflowContextService) is not available.