Copying Attachments
This API copies an attachment to the destination record.
API |
Signature |
---|---|
copyAttachment |
webService static Boolean copyAttachment(Id destParentId, Id attId) |
Request Parameter |
||
---|---|---|
Name |
Type |
Description |
destParentId | ID |
The ID of the destination parent record. |
attId | ID |
The ID of the attachment you want to copy. |
Response Parameter |
||
---|---|---|
Field |
Type |
Description |
isSuccess | Boolean |
Indicates 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;
}