Add attachment
The action adds to the workflow instance attachments that come from another, specified workflow instance, or are selected using an SQL query.
Basic configuration
The Basic tab of the Properties panel contains settings shared by every action in an automation: the Active toggle, the Action type field, the Documentation field, the Use action template toggle (when enabled, the action takes its configuration from the selected action template defined in the process), the Execution condition section (determines whether the action always runs or only when a custom rule is met), and the Runtime error handling section (the message and numeric error code returned when the action fails to execute). Since these settings are not unique to the Add attachment action, they are described in detail in the Actions chapter.

Advanced configuration
The Advanced tab contains fields specific to this action, grouped into sections: Attachment selection, Actions on source files, and Destination files settings.

1. Attachment selection
This section lets you specify where the attachments added to the current workflow instance come from:
- Based on instance ID - attachments are fetched from another, specified workflow instance.
- Based on SQL query - attachments are selected using an SQL query.
For the Based on instance ID mode, the Instance ID field is available, where you specify (built dynamically using the rule editor) the identifier of the workflow instance the attachments are fetched from.
The Additional filter field is also available, letting you narrow down which attachments of the specified instance are fetched:
- Category - attachments are selected based on their assigned category.
- Regular expression - attachments are selected using a regular expression matched against the file name.
For the Category mode, two additional fields are available:
- Category — the category of attachments taken into account:
- All - attachments belonging to any category are taken into account.
- Dynamic - selecting this option makes the Dynamic expression field available, where the category is built dynamically (using the rule editor) or entered manually, in the
ID#Nameor plainIDformat. - None - attachments not belonging to any category are taken into account.
- Select — which of the matching attachments will be added:
- All attachments - all matching attachments will be added.
- The oldest attachment - only the earliest added attachment will be added.
- The newest attachment - only the most recently added attachment will be added.
For the Regular expression mode, the Regular expression field is available, built manually or with the help of the variable editor.
When selecting attachment Based on SQL query mode, a single SQL for choosing source files field is available, where you provide a query that points to the source attachments:
- Pointing to existing attachments already stored in WEBCON — the query should return the
ATT_IDcolumn from the attachments table:If the attachment should be added to the destination workflow instance with a changed name or description, the query should also return theSELECT [ATT_ID] FROM [WFDataAttachmets] WHERE [ATT_Name] IN ('file.docx', 'file2.docx');FileNameand/orDescriptioncolumns. - Creating an attachment at execution time from binary data — the query must return a
FileNamecolumn with the file name and aContentcolumn with the attachment's binary content (optionally also aDescriptioncolumn):SELECT convert(image, <binaryContent>) AS Content, 'file1.txt' AS FileName
2. Actions on source files
This section determines what happens to the source attachments after they are added to the current workflow instance:
- Source files — how the source files are handled:
- Copy attachments - attachments are added to the current workflow instance while remaining on the source instance as well.
- Move attachments to the current instance - attachments are added to the current workflow instance and removed from the source instance.
- Verify user's permissions to source files - if selected, attachments the currently logged-in user has no permissions to will not be added to the workflow instance.
3. Destination files settings
This section determines the behavior of the files after they are added to the workflow instance:
- Category — the category the added files will be assigned to:
- None - the added attachment will not belong to any category.
- Dynamic - selecting this option makes the Dynamic expression field available, where the category is built dynamically (using the rule editor) or entered manually.
- Overwrite if attachment with this name already exists - if selected, and the workflow instance already has an attachment with the same name, it will be overwritten — a new historical version of the file will be created.
Detailed information on using this action can be found in the article The "Add attachment" action on the WEBCON technical blog.