Retrieving and Storing Aggregated Send Data

One of the great things about the WSProxy library for Server-Side JavaScript in Salesforce Marketing Cloud (SFMC) is that it has reinvigorated the use of SOAP API objects in the platform. SOAP objects are still foundational to understanding the SFMC data model.

Here’s one of my favorite applications of WSProxy — retrieving and storing aggregated Send data in a Data Extension using a Script Activity.

(BTW, check out what’s available — it’s everything in the Recent Email Sending Summary Report, plus some more details.)

Simply create a Script Activity in Automation Studio like this. Before the first run, update the TargetDECustomerKey and TargetDECategoryID values for your preferred Data Extension and folder. I generally use Send for the Data Extension name and customer key. As noted in the script, you can comment out Data Extension creation part after the first run.

This script sets a filter (it’s like a where-clause in SQL), iterates through the Send Object results, and upserts them into the specified Data Eextension. If you don’t want to retrieve all sends every time, you can uncomment the filter criteria and get more specific. I’ve generally not restricted it by date, because it’s not that much data to retrieve.

Finally, schedule this to run on an interval appropriate for your needs. At least daily is good.

Once you have data, you can toolbar-download it as needed, query it, export it with an Extract Activity, or lookup and display it in an email or CloudPage with AMPscript.

Oh Yeah

Oh Yeah by Yello

Oh yeah
Oh yeah
Oh yeah

The moon, beautiful
The sun, even more beautiful, ah ha ha
(Bow bow) Oh yeah (Chick chicka chicka)
(Doo, bow bow) Oh yeah (Chick chicka chicka)
(Bow bow) Oh yeah (Chick chicka chicka)

(Doo, bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
(Bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
Such a good time, a really good time
(Bow bow, chick chicka chicka)
(Bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)

(Bow bow) Beautiful (chick chicka chicka)
(Bow bow) Oh yeah (chick chicka chicka)
(Doo, bow bow) Oh yeah (chick chicka chicka)

(Bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
(Bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
Such a good time, a really good time
(Bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
Aaaah
(Bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
(Bow bow, chick chicka chicka)
(Chicka chicka)
(Chicka chicka)
(Chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
(Doo, bow bow)

The moon, beautiful
(Bow bow, chick chicka chicka) The sun, even more beautiful
Oh yeah
(Bow bow) Oh yeah
Oh yeah
Oh yeah
(Bow bow, chick chicka chicka)
(Doo, bow bow, chick chicka chicka)
(Bow bow, chick chicka chicka)

Ferris Bueller’s Day Off – Ferrari scene