Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Export Survey Results Embedded in Email Not Attachment

Avatar

Level 1

Hi

I am looking to export data from our surveys direct to our contact centre to action any issues raised. I have previously been doing this using a calculated attachment, but our contact centre are having issues with these.

How can I calculate the email content to include the results from the survey, rather than attaching a spreadsheet?

Topics

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

1 Reply

Avatar

Level 3

Hi @daniellee605809 ,

 

You could use the Query definition in the java script to directly fetch the survey data from the response to recipient forms or from the temporary table that is generated right after the query activity that fetches the data from response to recipient forms in the workflow.

 

Step 1 : Use a Java Script activity with QueryDef to fecth survey data

             Data oriented APIs | Adobe Campaign

Step 2 : in the same Java Script Use for each loop to run through the query      result 

Step 3 : in the same Java Script with the for each loop use variable(vars.html / instance.vars.html) along with Add AND assignment operator (+=) to generate the html code by appending the survey field values.

 

var condition="[@webAppLog-id] > 0";
var query = xtk.queryDef.create(
<queryDef schema="temp:readSurvey" operation="select">
<select>
<node expr="First_Name"/>

<node expr="Last_Name"/>
<node expr="Rating"/>
<node expr="@email"/>
<where>
<condition expr={condition} />
</where>

</select>

</queryDef>);

var res = query.ExecuteQuery();
logInfo(res);


for each (var item in res.readSurvey) {
vars.html +="<tr><td>"+item.First_Name+"</td><td>"+item.Last_Name+"</td><td>"+item.Rating+"</td><td>"+item.email+"</td><td>"
}


logInfo(vars.html);

 

 

Step 4 : use the variable in the delivery activity by including it in the delivery variables.

Step 5 :  include the delivery variable in the HTML email body.

Step 6 : Execute and test.

 

Thanks,

Shine v.v