Reports allow you to generate reports and take actions on a schedule you specify. 

You can use Reports for many purposes. For example:

  1. Generate reports as PDF email attachments
    The most common use for Reports is to send an email with a report as a PDF attachment. You can control the report format by creating an email attachment template. This template can display one or more records and any related records. For example, you could display all open Order records along with all Order Detail records for those open Order records.
  2. Generate reminders via Email, SMS, or Notifications
    You can use a Report to generate and send reminders via Email, SMS, or Notifications. For example, you can send reminders for all Orders that have been open for more than 3 days.
  3. Perform audits
    You can use a Report to check the data values in a table and send an Email listing any records containing invalid data values. For example, you can scan all records in the "Open Issues" table and report any that are unassigned. 
  4. Update records
    You can use a Report to update records. For example, you can scan all open maintenance requests, and assign the Status column the value "High", if the request has been open for more than 48 hours.

Report schedules are flexible. You can specify a daily, weekly, or monthly schedule. For example:

  • You can invoke an action each day at 8:00 AM Pacific Time.
  • You can invoke an action each weekday at 5:30 PM New Zealand Time.
  • You can invoke an action on the last day of each month at midnight Western European Time.

When you specify a schedule, you also specify a TimeZone. We support these time zones

Reports Are Only Run Automatically for Deployed Applications

Your Report will only be automatically run on the schedule you specify once your application has been deployed.

If you application is not deployed, your Report will not be run on the schedule you specify. However, you can invoke your Report by clicking the Run button on the Behavior > Reports pane.

Creating a Report

When you create a Report, the most important properties you specify are the table name and the create report option

Table Name
The Table Name property selects the target table or slice for the report.

The rows in the specified table or slice are included in the report. If you specify a slice with a "Row filter condition", only the rows that satisfy the "Row filter condition" will be included in the slice and in the report.

The columns in the specified table or slice can be included in the report. If you specify a slice that omits columns from "Slice Columns", those columns are omitted from the report.

Create Report

The Create Report option allows you to select either:

  1. "ForEntireTable"
  2. "ForEachRowInTable"

We describe both options below. The description of each option is long because we include sample reports for each option.

ForEntireTable

Choose ForEntireTable to create one action for the entire target table or slice. For example, choose this option if you want to create one report listing all orders in your Orders table. This allows you to see all of your orders in one Report.

When you choose ForEntireTable, the Report rule is simply invoked on the schedule you specify. No record or set of records is passed to the Report rule. You must specify a Start Expression in the template that yields the list of records you wish the Report to display. To be more specific, the Start Expression must yield the list of key values of the table rows to be displayed. The error message "Start expression 'xxx' refers to a table with missing meta data" may indicate that your Start Expression is not retrieving the table's key values.

When you choose ForEntireTable, we recommend creating a slice over the target table. This allows you to verify that your slice returns exactly the right set of records. Then use the slice name in the initial Start expression in you report template. For example:

"<<Start:FILTER(YourSliceName, true)>> 

You cannot create a Report rule by simply copying an existing event triggered workflow rule and adding a schedule. You must, at a minimum, add a Start Expression that yields a list of key values in the outermost template.

Condition

You can specify a Condition to control whether the Report is generated and sent when the Report is triggered. The Condition is an expression that evaluates to true or false. If the Condition is "true", the Report is generated and sent; otherwise, the Report is not generated or sent.

For example, the Condition expression could count the number of high value Orders that are present. If any high value Orders are present, the Report would be generated and sent; otherwise, the Report would not be generated or sent.

It is often easiest to create a slice that selects the row you wish to include in the report. For example, you might create a slice called "High Value Orders". The Report Condition can check if the "High Value Orders" slice contains any records. The Body or Attachment template can use the "High Value Orders" slice in its outermost Start expression to specify which records are included in the report.


Email Body and Attachment Templates

You can control the format of your report by specifying a Email Body template, a Email Attachment template, or both. This article describes templates in more detail.

Your template can format each table in either:

  1. List format
  2. Column format
  3. Table format

If you are displaying a hierarchy of tables, only the deepest level of the hierarchy can be displayed in Table format. For example, if you are displaying Customer, Order, and Order Detail records, only the Order Detail records can be displayed in Table format.

The following examples illustrate some options when creating reports. You can customize your templates to create much more elegant reports.

Report Template in List Format

This template is used to display Orders in list format.

It contains templates that display:

  1. The parent Customers record for each Orders record displayed in list format.
  2. The child Orders record displayed in list format.
  3. The list of child Order Details records for the Orders record displayed in list format.

 This template produces the following output:

Report Template in Table Format

This template is used to display Orders in table format.

It contains templates that display:

  1. The parent Customers record for each Orders record displayed in list format.
  2. The child Orders record displayed in list format.
  3. The list of child Order Details records for the Orders record displayed in table format.

 

This template produces the following output:

ForEachRowInTable


Choose "ForEachRowInTable" if you want to create individual reports for each row in the target table or slice. For example, choose this option if you want to create one report for each order in your Orders table.

When the Report is triggered, we retrieve the records from the table or slice you specify, and invoke the Report for each record in that table or slice. For example, you can create a slice over the Customers table that contains a record for each Customer having an "open" order. Your Report can send an email to each Customer that is included in this slice. Each email can be customized for that customer.

The Report is invoked once for each record in the table or slice. The Report is evaluated in the context of the current record. You can reference the columns in the current record when generating the Report. For example, the current record might contain the Customer's email address in its "Email" column. You can reference this "Email" column in the "To" property of your Email Report.

Your outermost template can use the column values from the current record. For example, if the action's Table name property specifies the Customers table, your template can refer to the "Name", "Address", "Phone Number", and "Email" column values in the current Customers record.

Your outermost template, can include an embedded template that lists the child records of the current record. The embedded template's Start Expression can use any Reverse Ref column in the current record to retrieve related child records. For example, the Customers table contains column "Related Orders  by Customer Name" which contains references to the customer's Orders. Your embedded template's Start Expression can use the "Related Orders by Customer Name" column to retrieve and list the child Orders records.

The Audit History reports the number of rows returned by the table or slice. This row count is displayed in the "ForEachRowInTable" property of the workflow rule's Audit History Detail record.

It is very important to keep in mind the number of rows in the target table or slice. If there is a large number of rows in the table/slice, a correspondingly large number of reports will be generated, which can temporarily overload the target email/sms inbox or web service. To avoid this, please avoid configuring reports to generate emails for each row in the target table/slice without first verifying that the number of rows in the table/slice is small. As a rule of thumb, if there is only a single fixed destination for all of the generated reports, it is a sign that you should be generating a single report for the entire table/slice instead. Only when the destination changes from row to row (for example, if the destination comes from a column in each row), should you be generating a new report per row.

Condition

You can specify a Condition to control whether the Report is performed for each row in the target table or slice. The Condition is an expression that evaluates to true or false. If the Condition is "true", the Report is generated and sent for that row; otherwise, the Report is not generated or sent for that row.

For example, the Condition expression could check if the row contains a high value Order. If the row contains a high value Order, the Report would be generated and sent for that row; otherwise, the Report would not be generated or sent for that row.

It is often easiest to create a slice that selects only the rows you wish. For example, you might create a slice called "High Value Orders". This makes the Condition unnecessary and the Report more efficient.

Email Body and Attachment Templates

You can control the format of your report by specifying an Email Body template, an Email Attachment template, or both. This article describes templates in more detail.

Your template can format each table in either:

  1. List format
  2. Column format
  3. Table format

If you are displaying a hierarchy of tables, only the deepest level of the hierarchy can be displayed in Table format. For example, if you are displaying Customer, Order, and Order Detail records, only the Order Detail records can be displayed in Table format.

The following examples illustrate some options when creating reports. You can customize your templates to create much more elegant reports.

Report Template in Table Format

This template is used to send an email to each customer having an open order.

This template displays:

  1. The current Customers record.
  2. The child Orders record displayed in list format.
  3. The list of child Order Details records for the Orders record displayed in table format.

This template produces the following output for each customer. We only show the output for the first customer "Ann Adams". Each customer would receive a similar report showing that user's order data.

Did this answer your question?