Attachment Archive

You can archive email PDF attachments. You control whether email PDF attachments are archived by specifying one of the following Attachment Archive options: 

  1. AttachAndDoNotArchive which attaches the PDF to the email but does not archive the PDF file.
  2. AttachAndArchive which attaches the PDF to the email and archives the PDF file.
  3. ArchiveAndDoNotAttach which archives the PDF file but does not attach the PDF file to the email. This option is useful if the PDF file is too large to include as an attachment. Instead, the email body can include the URL or Weblink to the archived PDF attachment.

If you choose to archive email PDF attachments, each email PDF attachment is written to a PDF file just before the email is sent.

Attachment Archive Provider

Normally, the PDF attachment file is archived to your authentication provider. For example, if your authentication provider is Google, the PDF attachment file is archived to Google drive. If your authentication provider is Dropbox, the PDF attachment file is archived to Dropbox.

If Smartsheet is your authentication provider, we archive the PDF attachment file to Google drive. We do this because Smartsheet does not have a file system. If you use Smartsheet and wish to archive PDF attachment files, you must include Google as a data provider. If Google is not already a data provider, you must go to Account>Data Sources and add Google as a data provider.

Attachment Folder Path

You can specify the Attachment Folder Path in the workflow action.

If you do not specify the Attachment Folder Path, then the default Attachment Folder Path value "Attachments" is used.

You can specify a constant Attachment Folder Path. For example: 

MyAttachments/MyPurchaseOrders

You can include expressions in the Attachment Folder Path. For example:

<<CONCATENATE("MyAttachments/PurchaseOrdersByMonth_", YEAR(NOW()), "_", MONTH(NOW()))>>

This might yield: 

MyAttachments/PurchaseOrdersByMonth_2019_02

As a result, each month's Email PDF attachments would reside in a separate folder.

Attachment Name

Attachment Name is described in topic "Attachment Name" here.

Disable Timestamp

By default, AppSheet includes a system generated Timestamp in the attachment file name. The Timestamp  contains the date and time at which the attachment was created. The date and time are formatted as "yyyyMMdd_HHmmss_fff" where "fff" is milliseconds. This ensures the attachment file name is unique. For example:

MyAttachmentName20190207_133355_804.pdf

You can omit the Timestamp by setting the Disable Timestamp? option to On in the workflow action. 

If you disable the timestamp, you must ensure that every file name is unique. If you fail to do this, one PDF attachment file may overwrite another. For example, if you are archiving your attachments to Google Drive, only the most recent attachment will be present. Earlier attachments with the same name will be overwritten.

Archive File Name

The Archive File Name is formed by combining the Attachment Name specified in the workflow action, with the optional Timestamp, and the file extension .pdf. 

If your Attachment Name is "MyAttachmentName" and Disable Timestamp? is disabled, then your Archive File Name would be something like:

MyAttachmentName20190207_133355_804.pdf

If your Attachment Name is "MyAttachmentName" and Disable Timestamp? is enabled, then your Archive File Name would be:

MyAttachmentName.pdf

Archive Folder Name

You can control the Folder Name in which the archived PDF file is written using the Default app folder property and the Attachment Folder Path specified in the workflow action.  

The folder name is formed by combining the Default app folder property in the Info > Property pane with the Attachment Folder Path specified in the workflow action. If no Attachment Folder Path is specified in the workflow action, then the default Attachment Folder Path value "Attachments" is used.

If the Default app folder is "/1track/data/MyApp-24403", and the Attachment Folder Path is not specified, then the archive folder name is:

/1track/data/MyApp-24403/Attachments

If the Default app folder is "/1track/data/MyApp-24403/MyDefnFolder1", and the Attachment Folder Path is "MyFolderA/MyFolderZ", then the archive folder name is:

/1track/data/MyApp-24403/MyDefnFolder1/MyFolderA/MyFolderZ

Archive File and Folder Name

The complete archive file and folder name is formed by combining the Archive Folder Name with the Archive File Name.

For example, if the Archive Folder Name is "/1track/data/MyApp-24403/Attachments" and the archive file name is "ChangeReport20190207_133355_804.pdf", then the archive file and folder name is: 

/1track/data/MyApp-24403/Attachments/ChangeReport20190207_133355_804.pdf

If the Archive Folder Name is "/1track/data/MyApp-24403/MyAttachments/PurchaseOrdersByMonth_2019_02" and the archive file name is "PurchaseOrder20190207_133355_804.pdf", then the archive file and folder name is: 

/1track/data/MyApp-24403/MyAttachments/PurchaseOrdersByMonth_2019_02/PurchaseOrder20190207_133355_804.pdf

Archive File and Folder Name in Audit History

The archive file and folder name is displayed in Audit History. You can view it by:

  1. Opening the Audit History as described in this article 
  2. Locating the workflow entry in Audit History.
  3. Looking for the following data in the Audit History entry "EmailAttachment": "Name: 'ScheduledReport.pdf' Archive: AttachAndArchive FileName: 'Workflow-24403/Attachments/ScheduledReport20190201_184450_854.pdf'",
  4. The "FileName" value indicates the file and folder where the attachment was archived.

Expression Variables for Attachment Archiving

The attachment file name is available for use in your workflow templates in the built-in variable _ATTACHMENTFILENAME. You can include this variable in your email Body or Attachment template to display the name of the archived attachment file.

The attachment file URL is available for use in your workflow templates in the built-in variable _ATTACHMENTFILE_URL. You can include this variable in your email Body or Attachment template to display the URL of the archived attachment file.

The attachment file hyperlink is available for use in your workflow templates in the built-in variable _ATTACHMENTFILE_WEB_LINK. You can include this variable in your email Body or Attachment template to display a hyperlink to the archived attachment file. The Attachment Name is displayed as the hyperlink text.

Constructing an Attachment File URL

Attachment file URLs take the form:

https://www.appsheet.com/template/getappfileurl?appName=<YourAppName>&fileName=<YourAttachmentFileName>

<YourAttachmentFileName> must specify the Attachment Folder Name followed by the Archive File Name. Omit the Default app folder name. Calls to "www.appsheet.com/template/getappfileurl" automatically prepend the Default app folder name.

The values <YourAppName> and <YourAttachmentFileName> must be URL encoded if them contain "reserved" or "unsafe" URL characters. For example, if <YourAppName> is "MyOrderApp-432567" and <YourAttachmentFileName> is "MyAttachments/MyPdfReport.pdf", then the URL is:

https://www.appsheet.com/template/getappfileurl?appName=MyOrderApp-432567&fileName=MyAttachments%2FMyPdfReport.pdf

In this example, the slash ("/") in the Attachment Name is URL encoded as "%2F".

Did this answer your question?