This API copies an attachment to the destination record.

copyAttachmentwebService static Boolean copyAttachment(Id destParentId, Id attId)

Request Parameter

The ID of the destination parent record.

attIdIDThe ID of the attachment you want to copy.

Response Parameter
isSuccessBooleanIndicates whether the copy was successful

Code Sample

The sample code below enables you to clone an attachment from any parent record and assign it to the destination SObject record.

 * The below code demonstrates how to copy from existing attachment and associate with given parent ID.
public Boolean createAttachment (String attachmentName, String proposalName)
	Boolean isSuccess;
    Id proposalSOID = [SELECT Id FROM Apttus_Proposal__Proposal__c WHERE Name = :proposalName LIMIT 1].Id;
    Id attachmentID = [SELECT Id FROM Attachment WHERE Name = :attachmentName LIMIT 1].Id;
	isSuccess = Apttus_Proposal.ProposalWebService.copyAttachment(proposalSOID, attachmentID);
	return isSuccess;