MoveAttachmentToCase
This function moves selected attachment from the current case into another case and attaches it to the document list. Attachment can also be added into document-type field, if the third parameter is provided. In case there is already another attachment in the target field, it is moved into document list.
Syntax
MoveAttachmentToCase(attachmentId, caseId, targetFieldName);
MoveAttachmentToCase(attachmentId, caseId);
MoveAttachmentToCase(fieldName, caseId, targetFieldName);
MoveAttachmentToCase(fieldName, caseId);
MoveAttachmentToCase(attachmentName, caseId, targetFieldName);
MoveAttachmentToCase(attachmentName, caseId);
Function arguments
- attachmentId – (String) ID of the attachment that is about to be moved;
- fieldName – (String) Name of the field with attachment on the current case;
- attachmentName – (String) Name of the attachment existing on the current case’s document list;
- caseId – (String) ID of the case which the attachment should be attached to;
- targetFieldName – (String) [optional] Name of the document-type field on the case where exactly the attachment will be added. If an argument is not provided, the attachment is added into document list.
Return value
This function returns Boolean.
Returns true if moving was successful, otherwise returns false.
Examples
Example 1:
This will move the attachment with id 200 from the current case into the case with id 1000. The attachment is about to be added in the field called „Invoice”.
if (MoveAttachmentToCase(200,1000,"Invoice")) { }
Example 2:
This will move the attachment with id 200 from the current case into the case with id stored in variable iCaseID. The attachment should be added to the document list.
iCaseID = 1000; if (MoveAttachmentToCase(200,iCaseID)) { }
Example 3:
This will move the attachment placed in the field „InvoiceDocument” from the current case into the case with id 1000. The attachment is about to be added in the field called „Invoice”.
if (MoveAttachmentToCase("InvoiceDocument",1000,"Invoice")) { }
Example4:
This will move the attachment „Invoice.tif” located on the document list of the current case into the case with id 1000. The attachment is about to be added in the field called „Invoice”.
if (MoveAttachmentToCase("Invoice.tif",1000,"Invoice")) { }
See also: CopyAttachmentToCase()