The File Attachment BIC provides the ability to attach files to a work item or to populate work item properties with details of files that may have been attached by a previous activity, such as an FTP GET operation or inbound Email-BIC configured to allow attachments.
In general, workflows should not be developed that have file attachments since they would mostly be accessible within work item viewers which are no longer the common way to interact with a work item in an EPX workflow. Instead, the user interacts with the anchor repository record and if there are attachments, they will likely be in the form of digital assets linked to that record. If files need to be attached to e-mails, the Send Email Callout BIC has a provision for including file attachments using the fully-qualified file path.
The configuration file named: <drive>:\Enterworks\EPX\bin\agents\<agentServer>\FileAttachmentBic.config specifies defaults for the following properties:
- directoryPath – default directory path. If the Directory Path field is not defined in a File Attachment BIC activity, this default value will be used.
- fileNames – default file names. If the File Names field is not defined in a File Attachment BIC activity, these default values will be used.
- resultsKey – default results key. If the Results Key field is not defined in a File Attachment BIC Activity, this default value will be used.
- debugEnabled – enables debug output to the bic.log if set to 'true'
An example file is shown below:
# FileAttachmentBic.config file
# Default directory path
directoryPath=d:/tmp
# Default list of file names
fileNames=*.sql,*.txt
# Default results key
resultsKey=FileAttachmentResults
# Enable debug reporting
debugEnabled=true
To add the File Attachment activity to a process flow, perform the following steps:
- Select the Automatic Activity icon and click the desired screen location. The BIC Selection dialog appears.
- Select 'File Attachment' and click OK.
- Open the property editor for the activity.
- Set the name of the activity on the General tab.
- Click the Settings tab.
- Optionally enter a directory path if all files to be imported are located on the same disk. If files from multiple disks are to be attached within a single activity, the Directory Path field must be left blank and the names in the File Names field must be fully qualified. The directory path can be a literal string or a work item property reference (surrounded by '%'), or a combination of the two. Since the backslash character may be used to designate a Windows directory, the escape character has been set to '^'. Wildcard characters ('*') cannot be specified in the directory path.
- Enter the names of the files to be attached in the File Names field. Separate file names with carriage-returns, or commas, or tabs. Spaces cannot be used as a delimiter since directory and file names can contain spaces. File names can include literal values, work item property references (surrounded by '%') and wildcard characters ('*') or any combination of the three. The wildcard character behaves the same as it does in DOS or UNIX list directory commands. Since the backslash character may be used to designate a Windows directory, the escape character has been set to '^'. The file names can include directory paths but the directory paths cannot contain wildcard characters ('*').
- Optionally specify a work item property field name in the Results Key field under which
the attachment processing results will be stored. The results key can contain a literal
value, work item property references (surrounded by '%'), or a combination of both.
The File Attachment BIC will generate the following properties:
- <resultsKey>.numberOfFiles – number of files found and attempted to be attached
- <resultsKey>.<file#>.file – path and name of file attempted to be attached
-
<resultsKey>.<file#>.status – status of attach operation:
- Attached - file was successfully attached
- Not a file – the file is a directory or some other non-regular file
- Unable to read file – the file could not be read
- Unable to copy file – the file could not be copied to the attachments directory
- Exception occurred during attachment copy: <message> - an unexpected error occurred during the copying of the file to the attachments directory.
where:
- <resultsKey> is the optional work item property key specified in the Results Key field of the property editor. If the key is left blank, these properties will be saved under the individual names.
- <file#> is the file number, starting with zero, to be imported. For example, if the Results Key is set to 'Attachments' and three files are specified for attachment, the entries may look like:
Attachments.numberOfFiles=3 Attachments.0.file=myFirstFile Attachments.0.status=Attached Attachments.1.file=dummyFile Attachments.1.status=Unable to read file Attachments.2.file=myThirdFile Attachments.2.status=Attached'
If the Results Key is not set, the same entries would appear as:
numberOfFiles=3 0.file=myFirstFile 0.status=Attached 1.file=dummyFile 1.status=Unable to read file 2.file=myThirdFile 2.status=Attached'.
- Click OK to save the activity.
- Connect the activity to the other activities in the flow. The File Attachment BIC cannot
be made a starting point within a flow. For example:
- Save the process flow.