Finalizes a multipart upload by assembling all the parts registered with copyPartMultiPartUpload, in order, into the final object in storage.
You still need to call
completeUploadafterward. This method only finishes the storage side — it does not update the Salesforce file record's "in progress" status.
You are here:
initializeUpload → initializeMultiPartUpload → copyPartMultiPartUpload (×N) → completeMultiPartUpload → completeUpload
See Uploading a file end-to-end for the full sequence.
How to call this method
global static String completeMultiPartUpload(String awsLocation, String uploadId, List<String> eTagList)
global static HTTPResponse completeMultiPartUploadResponse(String awsLocation, String uploadId, List<String> eTagList)
Parameters
|
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
|
|
Yes |
The file's storage key. |
|
|
|
Yes |
The value returned by |
|
|
|
Yes |
Every part's ETag, in part-number order — the same order you collected them in from |
Return value
Returns the final object's ETag (String).
⚠ Before you call this
-
This does not mark the Salesforce record as done. You must still call
SDriveTools.completeUpload(new List<Id>{ wipFileId })afterward — otherwise the file record stays stuck showing as "in progress" indefinitely, even though the storage side finished successfully. -
If you're calling storage directly from client-side code rather than through Apex (common for large files, to avoid Apex callout time limits), it's easy to finish this step and forget the follow-up
completeUploadcall back in Salesforce. Build that into your flow explicitly, as its own step, rather than assuming it happens automatically. -
Apex callouts have a timeout; for a large number of parts, consider making both this call and the individual part uploads from client-side code directly against the storage endpoint rather than through Apex.
Example
String finalETag = SDriveTools.completeMultiPartUpload(info.fileLocation, uploadId, partETags);
System.debug('Multipart upload finished in storage, final ETag: ' + finalETag);
// Required final step — without this, the file record never leaves "in progress" status:
List<ResultObject> results = SDriveTools.completeUpload(new List<Id>{ info.wipFileId });