ODBC Driver for Vault CRM

Build 26.0.9770

ExportAttachmentFieldFiles

Exports files stored in Attachment fields for one or more records in the given Vault object.

Stored Procedure-Specific Information

The records to export are supplied through the RecordList input, which takes the name of a temporary (#TEMP) table holding one record identifier per row. By default, the identifier is the Vault record Id; when you set the IdParam input to a unique object field, the table must instead hold that field's values.

Records are exported asynchronously in batches (up to 500 per job); larger tables are split into multiple jobs automatically. The operation waits for the export jobs to finish and downloads the resulting archive file parts.

Populating the RecordList Temporary Table

A temporary table is a connection-scoped table whose name ends in #TEMP. You do not create it explicitly: the first INSERT INTO that uses the #TEMP name brings the table into existence, and each subsequent INSERT adds more rows. Temporary tables last only as long as the current connection is open and are discarded when the connection is closed.

The recommended way to populate the table is an INSERT INTO SELECT query that collects the identifiers directly from the object you want to export from. An INSERT INTO SELECT selects a group of records from one table and inserts them into another as a single batch, which performs better than issuing many individual INSERT statements. For example, to gather the record ids of the product__v object:

INSERT INTO RecordList#TEMP (Id) SELECT Id FROM product__v

The column list in parentheses maps each selected record Id into the Id column of RecordList#TEMP. Add a WHERE clause to the SELECT to control exactly which records are included. You can also add rows one at a time with INSERT INTO ... VALUES:

INSERT INTO RecordList#TEMP (Id) VALUES ('V0Y000000000123')
INSERT INTO RecordList#TEMP (Id) VALUES ('V0Y000000000124')

Then pass the temporary table name and the same object name to the procedure:

EXEC ExportAttachmentFieldFiles ObjectName = 'product__v', RecordList = 'RecordList#TEMP', DownloadLocation = 'C:/Users/Public/exports/'

To identify records by a unique field other than the Vault Id, name the temporary table column after that field and set IdParam to the same field. For example, using external_id__v:

INSERT INTO RecordList#TEMP (external_id__v) SELECT external_id__v FROM product__v
EXEC ExportAttachmentFieldFiles ObjectName = 'product__v', RecordList = 'RecordList#TEMP', IdParam = 'external_id__v', DownloadLocation = 'C:/Users/Public/exports/'

RecordList Temporary Table Schema

Column NameTypeRequiredDescription
IdStringTrueThe Vault record Id to export attachment files for, populated from the Id column of the object named by ObjectName. When the IdParam input is set, use a column named after that unique field (for example, external_id__v) instead of Id.

Input

Name Type Required Description
ObjectName String True The name of the object from which to export Attachment field files.
RecordList String False The list of records to export the attachments for. The value must be a temporary table (#TEMP). By default it must contain an 'Id' column whose values are the record identifiers; when IdParam is set, it must instead contain a column named after that unique field. Up to 500 records are exported per job; larger lists are split into multiple jobs automatically.
FieldNames String False A comma-separated list of Attachment field names to export. If omitted, files from all Attachment fields on the specified object are included.
IdParam String False The name of a unique object field used to identify the records instead of the Vault 'id'. When set, the RecordList temporary table must contain a column with this field's name holding the record values (for example, external_id__v).
ExportTimeout String False The maximum number of seconds the entire operation may run, covering job submission, waiting for the export jobs, retrieving results, and downloading and reassembling the archives. Defaults to 3600. Set to 0 to run without a time limit.
PollInterval String False The number of seconds to wait between export job status checks. Defaults to 15. Values below the Vault minimum of 10 seconds are raised to 10.
DownloadLocation String False The local directory where the exported archive file parts are saved, using the file name provided by Vault.

Result Set Columns

Name Type Description
Success String Indicates whether the export job completed successfully.
JobId String The identifier of the export job. One row is returned per job.
FileName String The name of the reassembled .tar.gz archive containing the job's Attachment field files.
FileData String The reassembled archive encoded in Base64, returned only when both DownloadLocation and FileStream are empty (intended for small exports).
Records String A JSON aggregate of the per-record export results returned by Vault for the job, including each record's responseStatus and any warnings (for example, records with no Attachment field values).

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9770