Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards
SOLVED

Create a Daily Delivery Report sent by email

Avatar

Level 1

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.

 

TiphaineRU_1-1741796586383.png

 

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. 

TiphaineRU_0-1741796528149.png

 

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 🙂

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @TiphaineRU 

 

You are missing these 3 steps:

1. Create a delivery variable

_Manoj_Kumar__0-1741819969776.png

 

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

_Manoj_Kumar__1-1741819999122.png

 

3. Use the delivery variable in template

_Manoj_Kumar__2-1741820017242.png

 


     Manoj
     Find me on LinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hello @TiphaineRU 

 

You are missing these 3 steps:

1. Create a delivery variable

_Manoj_Kumar__0-1741819969776.png

 

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

_Manoj_Kumar__1-1741819999122.png

 

3. Use the delivery variable in template

_Manoj_Kumar__2-1741820017242.png

 


     Manoj
     Find me on LinkedIn

Avatar

Level 1

Thank you so much @_Manoj_Kumar_, it works perfectly !

 

Have a nice day 🙂