Skip to main content
Skip table of contents

completeUpload()

This method is used to complete attachments upload once the files have been uploaded to Amazon S3.
List<ResultObject> completeUpload(List<ID> wipIds)
Parameters:
wipIds: List of Salesforce ids for attachment "file" records. These IDs have been returned from the initializeUpload() method for each file record.

versionIds(Optional): List of AWS S3 versionIds ids for the attachment “file” record. These versionIds have been returned from the x-amz-version-id field from the AWS REST API response Headers. The array should match the order of of wipIds.

attachment "file" records. These IDs have been returned from the initializeUpload() method for each file record.
Return Value: The method will return the list of Result Object (Figure 127), which holds filecompletion status information.

 

Notes:

  1. If you want to confirm that file(s) are successfully uploaded to Amazon, you can use the getAmazonHeader() method to get headers which is returned by Amazon S3 for a given file. You can also compare the ETag header, the MD5 checksum calculated by Amazon when the file is uploaded to S3, with the MD5 that you calculate for the file(s).

  2. If you set the success{_}action_status to 201 status code during the upload process, you can also use XML document which is returned by Amazon S3 to compare ETag header with MD5 check sum.

Example code:

CODE
List<Id>wipIds = new List<Id>();
wipIds.add(ID.valueOf(uploadRequestInfos .fileWipId));
List<cg.ResultObject>resultObjects = cg.SDriveTools.completeUpload(wipIds);

 

With VersionIds.
Assume you have a method uploadToS3 that uses uploadRequestInfos as a parameter and returns a RestResponse object.

CODE
List<Id>wipIds = new List<Id>();
wipIds.add(ID.valueOf(uploadRequestInfos.fileWipId));
RestResponse restResponse = uploadToS3(uploadRequestInfos);
Map<String, String> headers = restResponse.getHeaders();
String versionId = headers.get('x-amz-version-id');
List<String> versionIds = new List<String>();
versionIds.add(versionId);
List<cg.ResultObject>resultObjects = cg.SDriveTools.completeUpload(wipIds, versionIds);

 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.