۶Ƶ

Send a report to a list sending-a-report-to-a-list

This use case details how to generate a monthly out-of-the-box Tracking indicators report in PDF format and how to send it to a list of recipients.

The main implementation steps for this use case are:

Step 1: Creating the recipient list step-1--creating-the-recipient-list

Go to the Profiles and targets tab, click the Lists link, then the Create button. Select New list and create a new recipient list for the report to be sent to.

For more on creating lists, refer to this section.

Step 2: Creating the delivery template step-2--creating-the-delivery-template

  1. Go to the Resources > Templates > Delivery templates node of the ۶Ƶ Campaign explorer and duplicate the Email delivery out-of-the-box template.

    For more on creating a delivery template, refer to this section.

  2. Enter the various template parameters: label, target (the list of previously created recipients), subject and content.

  3. Each time the workflow is executed, the Tracking indicators report is updated (refer to Step 3: Creating the workflow). To include the latest version of the report in the delivery, you need to add a Calculated attachment:

    For more on creating a calculated attachment, refer to this section.

    • Click the Attachments link and click Add, then select Calculated attachment.

    • Go to the Type field and select the fourth option: File name is computed during delivery of each message (it may then depend on the recipient profile).

      The value entered in the Label field will not appear in the final delivery.

    • Go to the edit zone and enter the access path and name of the file.

      note caution
      CAUTION
      The file must be present on the server. Its path and name must be identical to those entered in the JavaScript code type activity of the workflow (refer to: Step 3: Creating the workflow).
    • Select the Advanced tab and check Script the name of the file name displayed in the mails sent. Go to the edit zone and enter the name you want to give the attachment in the final delivery.

Step 3: Creating the workflow step-3--creating-the-workflow

The following workflow was created for this use case. It has three activities:

  • One Scheduler type activity that lets you execute the workflow once a month,
  • One JavaScript code type activity that lets you generate the report in PDF format,
  • one Delivery type activity that uses the previously created delivery template.

  1. Now go to the Administration > Production > Technical workflows node and create a new workflow.

  2. Start by adding a Scheduler type activity and configure it so that the workflow executes on the first Monday of the month.

    For more on configuring the scheduler, refer to Scheduler.

  3. Then add a JavaScript code type activity.

    Enter the following code in the edit zone:

    code language-none
    var reportName = "deliveryFeedback";
    var path = "/tmp/deliveryFeedback.pdf";
    var exportFormat = "PDF";
    var reportURL = "<PUT THE URL OF THE REPORT HERE>";
    var _ctx = <ctx _context="global" _reportContext="deliveryFeedback" />
    var isAdhoc = 0;
    
    xtk.report.export(reportName, _ctx, exportFormat, path, isAdhoc);
    

    The following variables are used:

    • var reportName: enter the internal name of the report in double quotes. In this case, the internal name of the Tracking indicator report is “deliveryFeedback”.

    • var path: enter the save path of the file (“tmp/files/”), the name you want to give the file (“deliveryFeedback”) and the file extension (“.pdf”). In this case, we have used the internal name as the file name. Values need to be between double quotes and separated by the “+” character.

      note caution
      CAUTION
      The file must be saved on the server. You must enter the same path and the same name in the General tab of the edit window for the calculated attachment (refer to: Step 2: Creating the delivery template).
    • var exportFormat: enter the export format of the file (“PDF”).

    • var _ctx (context): in this case, we are using the Tracking indicators report in its global context.

  4. Finish by adding a Delivery type activity with the following options:

    • Delivery: select New, created from a template, and select the delivery template created previously.
    • For the Recipients and Content fields, select Specified in the delivery.
    • Action to execute: select Prepare and start.
    • Un-check Generate an outbound transition and Process errors.

recommendation-more-help
601d79c3-e613-4db3-889a-ae959cd9e3e1