Create a Daily Delivery Report sent by email | Community
Skip to main content
March 12, 2025
Solved

Create a Daily Delivery Report sent by email

  • March 12, 2025
  • 1 reply
  • 647 views

Hello,

I am currently trying to implement a daily report sent by email to members of my team. 

I built a workflow fetching data about some recurring campaigns (campaign name, delivery name, contact date, success rate, last contact date with volume). The query is made on the 'Deliveries' dimension.

 

I put in place a Javascript code trying to build a table with those data, and Adobe seems to accept it when I run the workflow (though I don't know if it is actually working).

vars.content = '<TABLE style="border: 1px solid black; border-image: none; width: 100%;"><TBODY><TR><TH style="border: 1px solid black; border-image: none; width: auto;">Séquence</TH><TH style="border: 1px solid black; border-image: none; width: auto;">Touche</TH><TH style="border: 1px solid black; border-image: none; width: auto;">Date de contact</TH><TH style="border: 1px solid black; border-image: none; width: auto;">Success Rate</TH><TH style="border: 1px solid black; border-image: none; width: auto;">Last Contact With Volume</TH></TR>'; var query = NLWS.xtkQueryDef.create( {queryDef: { schema: vars.targetSchema, operation: "select", select: { node: [ {expr: "@deliveryCode"}, {expr: "@campaign"}, {expr: "@delivery"}, {expr: "@campaign"}, {expr: "@contactDate"}, {expr: "@successRate"}] }, orderBy: { node: {expr: "@campaign", sortDesc: "true"} } }}) var res = query.ExecuteQuery() var records = res.getElementsByTagName("*") for each (var w in records) { vars.content += '<TR>'; vars.content += '<TD style="border: 1px solid black; border-image: none;">'+ w.getAttribute("campaign")+'</TD>'; vars.content += '<TD style="border: 1px solid black; border-image: none;">'+ w.getAttribute("delivery")+'</TD>'; vars.content += '<TD style="border: 1px solid black; border-image: none;">'+ w.getAttribute("contactDate")+'</TD>'; vars.content += '<TD style="border: 1px solid black; border-image: none;">'+ w.getAttribute("successRate")+'</TD>'; vars.content += '<TD style="border: 1px solid black; border-image: none;">'+ w.getAttribute("lastContactwithVolume")+'</TD>'; vars.content += '</TR>'; } vars.content += '</TBODY></TABLE>';

 

I now have trouble actually sending the report.

 

 

As I'm not building my workflow on the recipient dimension, I used a standard delivery to be sure that the email will be sent to me. 

 

The content of the delivery is very simple, it is simply a title and a call for the <%vars.content%> variable. 

 

When I put the JS code before the delivery, I receive the report without the <%vars.content%> being generated (it simply says "<%vars.content%>" in plain text).

 

When I put the JS code inside the "script" tab on the delivery, I don't receive the report at all.

 

Can someone give me a hand please ? I know this is something doable as I've seen it in the past but I have trouble reproducing it. 

 

Thank you 🙂

 

Best answer by Manoj_Kumar

Hello @tiphaineru 

 

You are missing these 3 steps:

1. Create a delivery variable

 

2. Assign value of vars.content to a the delviery variable

 

3. Use the delivery variable in template

 

1 reply

Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
March 12, 2025

Hello @tiphaineru 

 

You are missing these 3 steps:

1. Create a delivery variable

 

2. Assign value of vars.content to a the delviery variable

 

3. Use the delivery variable in template

 

Manoj  | https://themartech.pro
March 20, 2025

Thank you so much @_manoj_kumar_, it works perfectly !

 

Have a nice day 🙂