Create a report with information of a record and send it by email

HEFLO gives you the ability to generate reports and display them in a workspace page using a widget, or send them during the execution of a process.

In this article, we will show how to access the report editor and create a report with information from a particular record. We will then add this report as an email template attachment.

We will use this process to demonstrate this feature.

The objective is to automatically send an e-mail every month with a document attached containing the products record information.

 

We will show the different steps to create the document that will be sent as an attachment.

Enable database replication for your environment

To retrieve information from a record, we will need to create a query in the process editor using information from the database associated with your environment.

If you have already enabled this feature in your environment, then you can skip this part.

To enable database replication for your environment, follow these steps:

  1. Go to the Process Editor.
  2. Click on the icon of “Visualization mode”.
  3. Click “Data Export”.
  4. Click “Activate this feature now!”.
  5. Wait for database replication to complete.

 

Once database replication is complete, you can access the database structure, view the data, and export it. To know more: Tutorial: Data export.

Create a report

To access the report editor and create a report, follow these steps:

  1. Go to the Process Editor.
  2. Click the “Visualization Mode” icon.
  3. Click “Reports”.
  4. Click the “+” button.
  5. Give the report a name and click the “Open report editor” button.

 

You are redirected to the report editor.

You can use the different elements on the left to add fixed information to your report or to format it. You must drag and drop these elements onto the editing area which is located in the central part of the editor.

Warning: The editing area is divided into three parts: the top margin, the central part of the report and the bottom margin. You can increase the size of these different parts, and add new parts if necessary.

In our example, we will add a title to this report and a table that will contain the products record information.

 

Link the report to information from a record

To retrieve data for a particular record, you must link the report to the record view contained in your environment’s database replication.

To learn more about database replication views and how to view them: Tutorial: Data export.

Get record view name

First of all, you need to get the name of the view of the record concerned. Follow these steps to get this information:

  1. Access the “Data Export” functionality seen previously. To learn more about data export: Tutorial: Data export.
  2. Go to the “Tools” tab and click the “View Schema” button.
  3. Research the record.
  4. Copy the name of the view containing the record.
    For information: You can also create a consultation query
    to join multiple records.
  5. Return to the “Tools” tab and click “Compile all views” to update the database.

 

Now go back to the report editor and open the previously created report.

Create a query to retrieve view data

Once the name of the record view is retrieved, we will be able to create a query to link the report to the work item information for this record. Follow these steps to make this configuration:

  1. Click the database icon.
  2. Click on this icon  , then click on “Replica database”. The report editor then retrieves the database replication information.
  3. Click on “Replica_database1”, then click on this icon  .
  4. Give the query a name.
  5. Write the query in the “SQL String” part to retrieve the information from the concerned record view. This query is of type “select”. It should be written like this:

    select * from “record view name”

    It is therefore in the “record view name” part that you must paste the previously copied view name.

    For information: If your record contains special characters, put the “record view name” in: “, like this:`record view name`.
  6. Click “Finish”. An arrow icon will then appear to the left of “Replica_database1”.
  7. Click this arrow icon, then click the arrow icon to the left of your query name. The list of different properties, columns, of your record view is then displayed.

 

For better user experience we suggest you use dark mode.

Put view properties in report

You can now drag information corresponding to the record properties into the report. Follow these steps to add this information:

  1. Click on the desired property.
  2. Drag it to the central part of the report. 

    For information: you can select several properties by holding down the “ctrl” key. Then drag them onto the report.
  3. Format the size and location of this information.

     

  4. Change the data type associated with the property concerned if necessary.
    1. Click on the property.
    2. Click on the gear icon.
    3. Click on this icon in the “Text Format String” field.
    4. Update the data type associated with this property.

       

  5. Do not select any report item and click the gear icon.
  6. In the “Properties” field select “XtraReport (Report)”.
  7. Choose the query you created in the “Data Member” field.

 

  1. Click the “Preview” button. The report editor will then display the configured report with the corresponding record data.
  2. Click the “Design” button to return to the editing screen.
  3. Save your report, exit the Report Editor and return to your Process Editor.

 

Attach a report to an email template

Now you need to attach this report to an email template. To configure this, follow these steps:

  1. Go to the Process Editor.
  2. Click the “Visualization Mode” icon.
  3. Click on “Message Templates”.
  4. Choose the desired template or create a new one by clicking on the “+” icon.
  5. Click the “Attachments” button at the bottom of the dialog box.
  6. Scroll down, and in the templates section, click the “+” button.
  7. Click on the “Report” button.
  8. Choose the name that will be given to this attachment.
  9. Select the desired report.
  10. Click “Confirm” to validate the email template. To learn more about how to configure an email template: Creating email templates and attachments.

 

When performing a production work item, the data of the record will be automatically displayed in the report parameters and will appear in the PDF document which will be attached to the email.

For information: Test work item reports do not generate data.

Warning: You can only choose reports that have been edited in the report editor. If you simply created a report without customizing it, it will then be visible in the list of reports but you will not be able to select it.

You can also check this article: Create a report with information about a work item and send it by email.

Was this article helpful?

Related Articles