You can learn more about sending email, using templates, and using expressions with workflow in the Workflow: Sending Email section.

Configuring Email

You can customize the email you send. Customization makes extensive use of variables. You can customize the following aspects of the email.

Send to: This is a list of email addresses or expressions that yield email addresses. Each value must be entered on a separate line.

  1. You can enter specific email addresses, such as JohnHughes@gmail.com. If you enter an email address that contains special characters such as hyphen or plus, you must enclose the email address in quotes, such as "John-L-Hughes@gmail.com".
  2. You can specify that the email address be taken from a field in the record that is being updated. For example, when a new order is added, you may wish to send email to the customer who created the order. You can do this by entering an expression specifying the field name containing the customer's email address. For example, if there is a field called "CustomerEmail" in the added order record, you can specify [CustomerEmail] in the email address list.
  3. You can specify that the email address be taken from a field in a record that is referenced by the record being added or updated. For example, each of your Order records might contain a reference to a Customer record. Each Customer record might contain the customer's email address. When a new order is added, you can send email to the customer who created the order. You can do this by entering the name of the Order record field that references the customer record, followed by the name of the Customer record field containing the customer's email address. For example, assume the name of the Order record field that references the customer record is CustRef. Assume the name of the Customer record field containing the customer's email address is CustEmail. You can specify the customer's email address by entering the expression [CustRef].[CustEmail] in the email address list.
  4. You can specify that the email addresses be taken from an entire column in another table. For example, you could create a table called PeopleToInform having two columns, Name and EmailAddress. Each time a new order is added, you can send email to all of the people in the PeopleToInform table. Do this by entering the expression PeopleToInform[EmailAddress] in the email address list.

While the app is in test mode (i.e. it has not passed a Deployment Check), any messages sent from workflow actions will only be sent to the app creator.

You can see the "Send to", "CC", and "BCC" values who would have received the email by checking the Audit History. It will contain a warning like the following:

"Warnings": "Warning: The client device is running app version 1.000287, which is the latest version. That version is not deployed so all workflow emails are being sent to the app creator. This email would have gone To 'ann@gmail.com' CC'ed to 'bob@gmail.com' and BCC'ed to 'carol@gmail.com'",

Email Subject:
AppSheet uses a default subject, but you can override that with your own subject text. You can include variables in the subject that are replaced by values from the updated record.

Here are three example subject lines:
Thanks for your order!
Thanks <<CustomerName>> for your order!
Thanks <<CustomerName>> for your order on <<TODAY()>>! 

Email body: You have three options when it comes to the body of the email. 

  1. You can do nothing and receive a Default Email Body.
  2. You can customize the Email Body field.
  3. You can specify an Email Body template.

Default Email Body
Here's what it looks like if you do nothing and receive a default email body. It contains all of the values for the updated row except for Hidden columns and Show type columns.

Email Body
You can specify a Body containing text, images, variables, and expressions directly in the Body attribute. After the variables and expressions are replaced, the result becomes the email body. 

Specifying the Body in this way works if you have a very simple email Body; otherwise, you should use an Email Body Template.

Email Body Template
You can control the contents and format for your email body by using either a Google Doc or Microsoft Word Document as a template file as described here. We recommend using an Email Body Template if you wish to control the format of the email body.

Attachment Template

You can optionally add an attachment to your email by specifying an Attachment Template. The Attachment Template can take many forms including:

  1. PDF Attachment
  2. XML Attachment
  3. JSON Attachment
  4. Text Attachment

PDF attachments are the most popular form of attachment. Other forms of attachment are useful but rare.


PDF Attachment:

You can create a PDF attachment by using a Google Doc or a Microsoft Word template file as described here.

The PDF attachment can be at most 20MB in size.


XML Attachment:

You can create an XML attachment using a .txt template file containing XML.

You can create a template file by creating an empty .txt file on your personal computer, entering XML text like that below, and saving the file to your personal computer.

 <?xml version="1.0" encoding="UTF-8"?>
<record>  
   <UpdateMode><<_UPDATEMODE>></UpdateMode>
   <Application><<_APPNAME>></Application>
   <TableName><<_TABLENAME>></TableName>
   <UserName><<_USERNAME>></UserName>
   <LastName><<LastName>></LastName>
   <FirstName><<FirstName>></FirstName>
   <Age><<Age>></Age>
  <Computed Total><<[Qty]*[Price]></Computed Total>
   <ComputedName><<_ComputedName>></ComputedName>
</record>

Once the template file is saved to you personal computer, upload it to one of the following Data Sources:

  1. Box
  2. Dropbox
  3. Google Drive
  4. Microsoft Office 265
  5. Microsoft OneDrive

For example, you can upload the template file to Google Drive, as follows. 

  1. Open Google Drive and navigate to the Google Drive folder where you wish to upload the file. 
  2. Click the "New" button and then click "File upload". 
  3. When the file open dialog appears, navigate to the template file on your personal computer, select the file, and click "Open". This will upload the template file to Google Drive.

Once the template file is uploaded:

  1. Click the file icon for the AttachmentTemplate field. 
  2. When the "Select a file" dialog appears, navigate to the uploaded template file and select it.
  3. This makes the uploaded template file the current AttachmentTemplate.

Each time you modify and upload the template file to Google Drive, Google Drive will assign it a new DocId. You must click the file icon for the AttachmentTemplate field, as described above, to make the newly uploaded template file the current AttachmentTemplate.


JSON Attachment:

You can create an JSON attachment using a .txt template file containing JSON.

You can create a template file by creating an empty .txt file on your personal computer, entering JSON text like that below, and saving the file to your personal computer.

   UpdateMode: <<_UPDATEMODE>>,
   Application: <<_APPNAME>>,
   TableName: <<_TABLENAME>>,
   UserName: <<_USERNAME>>,
   LastName: <<LastName>>,
   FirstName: <<FirstName>>,
   Age: <<Age>>,
   Computed Total: <<[Qty]*[Price]>,
   _ComputedName: <<_ComputedName>>

Once the template file is saved to you personal computer, upload it to one of the following Data Sources:

  1. Box
  2. Dropbox
  3. Google Drive
  4. Microsoft Office 265
  5. Microsoft OneDrive

For example, you can upload the template file to Google Drive, as follows. 

  1. Open Google Drive and navigate to the Google Drive folder where you wish to upload the file. 
  2. Click the "New" button and then click "File upload". 
  3. When the file open dialog appears, navigate to the template file on your personal computer, select the file, and click "Open". This will upload the template file to Google Drive.

Once the template file is uploaded:

  1. Click the file icon for the AttachmentTemplate field. 
  2. When the "Select a file" dialog appears, navigate to the uploaded template file and select it.
  3. This makes the uploaded template file the current AttachmentTemplate.

Each time you modify and upload the template file to Google Drive, Google Drive will assign it a new DocId. You must click the file icon for the AttachmentTemplate field, as described above, to make the newly uploaded template file the current AttachmentTemplate.

Attachment Name: You can specify a portion of the name given to the email attachment. The default AttachmentName is “ChangeReport”. 

You can specify a different name and you can include variables in the AttachmentName. For example:
"My Attachment Name"
"My Attachment for <<_APPNAME>>"
"My Attachment for <<CustomerName>> on <<TODAY()>>"

The attachment file name consists of the Attachment Name you specified above, suffixed with the system generated date and time including milliseconds 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:

MyAttachmentName20171107_133355_804.pdf

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.

The PDF attachment file 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/ScheduledReport20171201_184450_854.pdf'",
  4. The "FileName" value indicates where the attachment was archived.


Attachment Archive:
You can specify 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.

The PDF attachment file is archived just before the email is sent.


Attachment Archive Folder:

We archive the PDF attachment file to the Data Source that serves as your authentication provider. 

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.

By default, the PDF attachment file is archived to the folder:

<<Default app folder>>/Attachments

Where the <<Default app folder>> name is displayed in the Editor on the Info>Properties pane in the "Default app folder" property.

However, you have a degree of control over the attachment folder name. By including expressions and slashes in the "Attachment Name" property you can archive the PDF file to different sub-folders beneath the "<<Default app folder>>/Attachments" folder. For example, in the "Attachment Name" property you can specify an expression like:

<<CONCATENATE(YEAR(NOW()), MONTH(NOW()), "/")>>ChangeReport

This expression yields an "Attachment Name" property like:

201812/ChangeReport

This will archive the PDF attachment to the folder:

<<Default app folder>>/Attachments/201812/

with a file name like:

 "ChangeReport20181227_104500_230"

Attachment Page Orientation: You can specify either "Portrait" or "Landscape". 

Attachment Page Size: You can specify the page size. 

Other Attachments: You can attach Image, Signature, Drawing, Thumbnail, or other Files to your email. This is often used by applications that take photographs and want to attach one or more photos to the workflow email. This can also be used to attach one or more existing PDF, Microsoft Word, or Microsoft Excel files, among others.

Each attachment file name must be entered on a separate line. You can enter file names or expressions that yield file names. 

We simply attach the documents you specify to the email. We do not replace variables in these attachments like we do for the Attachment template.

You can specify:

  • A file name such as MyPhoto.jpeg or MyWordFile.docx.
  • A simple column expression like [ImageColumn] or [FileColumn] where the file name is stored in the column.
  • A more complex expression, like the de-reference expression [ProductRef].[ProductPhoto]. Here the file name is stored in the [ProductPhoto] column. 

Your application can control which attachment files to include.

  1. Create an EnumList field containing the names of the attachments you can choose from. I called my EnumList  field "Attachments" and entered  the EnumList values "PDF1", "PDF2", and "PDF3".
  2. In your workflow rule, specify the following expression in the "OtherAttachments" property:

    LIST(IF(CONTAINS([Attachments], "PDF1"),"PDF1.pdf","")) + LIST(IF(CONTAINS([Attachments], "PDF2"),"PDF2.pdf","")) + LIST(IF(CONTAINS([Attachments], "PDF3"),"PDF3.pdf",""))


Your attachment files must reside in the right place for us to find them.

For Google, Microsoft, Dropbox, Box, and other providers that are capable of storing files, we start from the folder containing your worksheet. If you only specify a file name, we look for this file in the folder contains your worksheet. If you specify both folder names and a file name, we start from the folder containing your worksheet and follow the folder path you specify.

Your attachment files must be secured properly for us to retrieve them. Normally, you must secure your attachment files so that the app owner can read them. This is necessary because, the app is running under the identity of the app owner.

In the rare case when your app is using a private table, you must secure your attachment files so that the current app user can read them. This is necessary because, when private tables are used, the app is running under the identity of the app user rather than the app creator. When using private files, we look for the attachment files relative to the private user's worksheet. As a result, the attachment files from each private file user are unique to that user.

For SQL Server. MySQL, and other providers that are not capable of storing file, we look for attachment files in the main cloud file system associated with the app creator's primary AppSheet account, be it Google Drive, Dropbox, Office 365, or Box. We start from the folder you specify in the "Default folder path" of the My Account > Settings pane.
 

CC: Email "CC" value. This is a list of email addresses or expressions that yield email addresses as described with Send to. Each value must be entered on a separate line.

BCC: Email "BCC" value. This is a list of email addresses or expressions that yield email addresses as described with Send to. Each value must be entered on a separate line. 

Reply to: Email "Reply to" email address. You may specify:

  • Nothing, in which case the reply to email address is "noreply@appsheet.com" .
  • A specific email addresses, such as JohnHughes@gmail.com. If you enter an email address that contains special characters such as hyphen or plus, you must enclose the email address in quotes, such as "John-L-Hughes@gmail.com".
  • An expression that yields a single email address.

From Display: Email "from display" value. This value is displayed as the source of the email. You can specify:

  • Nothing, in which case the application owner name is used.
  • A constant value which is enclosed in quote characters.
  • A template that yields a text value.
    The template may including text, variables that refer to column values in your tables, and expressions that yield computed values.

    For example:

    From <<[FirstName]>> <<[LastName]>>

    <<CONCATENATE("From ", [FirstName], " ", [LastName])>>

From: Workflow email is always sent from the AppSheet "noreply@appsheet.com" email account. You cannot override this value because the anti-spam policies of email providers do not permit us to send mail and masquerade as different email originators.

If you must customize the From email address, consider sending email via a web based email provider that you invoke via a workflow web hook.

PreHeader: The default PreHeader value is "'<<_UPDATEMODE>> to application '<<_APPNAME>>' table '<<_TABLENAME>>' by '<<_USERNAME>>' at '<<_NOW>>'". This would yield a PreHeader such as "Update to application 'Workflow' by 'Julie Morgan' at 8/26/2015 6:12:28 PM". You may customize the PreHeader and include variables.

You can suppress the PreHeader by entering a single empty character.

 

Troubleshooting Email 

See this article.

 

Did this answer your question?