I want to retrieve the email name associated with a triggered send definition via WSProxy on a Cloud Page. To be clear, I'm not trying to retrieve the name of the Triggered Send Definition, rather the name of the Email used in the Triggered Send Definition. Using sample code found elsewhere on StackExchange for displaying an automation's status, I created the following:

 <script runat="server">


  var debug = false;

  try {

    var prox = new Script.Util.WSProxy();
    var mids = [MID_GOES_HERE];

    if (debug) {
      Write("<br>mids: " + Stringify(mids));
    Write("<table border='1'>");
    Write("<th>Business Unit</th>");
    Write("<th>Trigger Status</th>");
    Write("<th>Trigger Name</th>");
    Write("<th>Email Name</th>");

    for (i = 0; i < mids.length; i++) {

      var mid = mids[i];
      prox.setClientId({"ID": mid});
      var obj = "TriggeredSendDefinition";   
      var cols = ["ObjectID","CustomerKey","TriggeredSendStatus","Name","Email"];

      var filter = {
                 Property: "CustomerKey"
          , SimpleOperator: "IN"
          , Value: ["CUSTOMER_KEYS_TO_FILTER"]

      var opts = null;
      var props = null;

      var moreObjs = true;
      var reqID = null;

            while (moreObjs) {

          moreObjs = false;

          var objs = reqID == null ? prox.retrieve(obj, cols, filter, opts, props) : prox.getNextBatch(obj, reqID);

          if (objs != null) {

              moreObjs = objs.HasMoreRows;
              reqID = objs.RequestID;

              for (var j = 0; j < objs.Results.length; j++) {

                var triggerObj = objs.Results[j];

                var status = "";
                   switch (triggerObj.TriggeredSendStatus) {
                    case "New": status = "New"; break;
                    case "Inactive": status = "Paused"; break;
                    case "Active": status = "Running"; break;
                    case "Canceled": status = "Archived"; break;
                    case "Deleted": status = "Deleted"; break;

                Write("<td>" + mid + "</td>");
                Write("<td>" + status + "</td>");
                Write("<td>" + triggerObj.Name + "</td>");
                Write("<td>" + triggerObj.Email + "</td>");







  } catch (e) {

    if (debug) {
      Platform.Response.Write("<br><br>e: " + Stringify(e));

This script shows the table but no data is returned. If I adjust the script to remove "Email" from the 'var cols' a NULL is displayed for email name.

The TriggeredSendDefinition Object lists "Email" as a property here.

I'm not too experienced with this sort of script, so am unsure of what to adjust or if it's even possible to accomplish what I'm trying to.

1 Answer 1


The "Email" property of a TriggeredSendDefinition isn't "retrievable". You can understand what's retrievable within a SOAP object using a Describe call.

The property you'll initially need to include in your "cols" collection is "Email.ID":

var cols = ["ObjectID","CustomerKey","TriggeredSendStatus","Name","Email.ID"];

Then, with the ID of the Email, you can get its name by doing a REST call using the Assets API

var endpoint = restEndpoint + 'asset/v1/content/assets?$filter=id%20eq%20' + triggerObj.Email.ID;
var response = Platform.Function.ParseJSON(Platform.Function.HTTPGet(endpoint,false,0,['Authorization'],['Bearer ' + myToken],status));
var emailName = response.items[0].name;

This'll all be very slow, so you could optimise a little by not nesting the REST call within a loop, like that, by doing a single call after the loop's finished to go and get all the emails you're interested in using the /asset/v1/content/assets/query and use the "in" operator within your filter. It'd still be pretty slow, but not as slow.

Somewhat more complex would be to cache the email names in a DE, so you only go and retrieve names for email IDs you've not encountered before.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .