Retrieve all TriggeredSend definitions verified

Learn how to retrieve all TriggeredSend Definitions in Salesforce Marketing Cloud (SFMC) with SSJS (server-side JavaScript). Code snippets include the WSProxy method.

WSProxy

var api = new Script.Util.WSProxy();

var config = {
    name: "TriggeredSendDefinition",
    cols: ["Name", "TriggeredSendStatus", "ObjectID", "CustomerKey"],
    filter: {
        Property: "TriggeredSendStatus",
        SimpleOperator: "IN",
        Value: ["Active", ""]
    }
}

var result = [],
    moreData = true,
    queryAllAccounts = config.queryAllAccounts || false,
    reqID = request = null;

while(moreData) {

    moreData = false;

    if (reqID == null) {
        request = api.retrieve(
            config.name, 
            config.cols, 
            config.filter, 
            queryAllAccounts
        );
    } else {
        request = api.getNextBatch(config.name, reqID);
    }

    if (request != null) {

        moreData = request.HasMoreRows;
        reqID = request.RequestID;

        for (var i = 0; i < request.Results.length; i++) {
            result.push(request.Results[i]);
        }

    }

}
<script runat="server">

    Platform.Load("core", "1");

    var api = new Script.Util.WSProxy();

    try {

        var config = {
            name: "TriggeredSendDefinition",
            cols: ["Name", "TriggeredSendStatus", "ObjectID", "CustomerKey"],
            filter: {
                Property: "TriggeredSendStatus",
                SimpleOperator: "IN",
                Value: ["Active", ""]
            }
        }

        var result = [],
            moreData = true,
            queryAllAccounts = config.queryAllAccounts || false,
            reqID = request = null;

        while(moreData) {

            moreData = false;

            if (reqID == null) {
                request = api.retrieve(
                    config.name, 
                    config.cols, 
                    config.filter, 
                    queryAllAccounts
                );
            } else {
                request = api.getNextBatch(config.name, reqID);
            }

            if (request != null) {

                moreData = request.HasMoreRows;
                reqID = request.RequestID;

                for (var i = 0; i < request.Results.length; i++) {
                    result.push(request.Results[i]);
                }

            }

        }

        Write(Stringify(result));

    } catch (error) {

        Write(Stringify(error));

    }

</script>
[
    {
        "TriggeredSendType": "Continuous",
        "TriggeredSendStatus": "Active",
        "Email": null,
        "List": null,
        "AutoAddSubscribers": false,
        "AutoUpdateSubscribers": false,
        "BatchInterval": 0,
        "BccEmail": null,
        "EmailSubject": null,
        "DynamicEmailSubject": null,
        "IsMultipart": false,
        "IsWrapped": false,
        "AllowedSlots": 0,
        "NewSlotTrigger": 0,
        "SendLimit": 0,
        "SendWindowOpen": "0001-01-01T00:00:00.000",
        "SendWindowClose": "0001-01-01T00:00:00.000",
        "SendWindowDelete": false,
        "RefreshContent": false,
        "ExclusionFilter": null,
        "Priority": null,
        "SendSourceCustomerKey": null,
        "ExclusionListCollection": null,
        "CCEmail": null,
        "SendSourceDataExtension": null,
        "IsAlwaysOn": false,
        "DisableOnEmailBuildError": false,
        "KeepExistingEmailSubject": false,
        "PreHeader": null,
        "ReplyToAddress": null,
        "ReplyToDisplayName": null,
        "DataSchemas": null,
        "TriggeredSendClass": "Standard",
        "TriggeredSendSubClass": "Standard",
        "TriggeredSendVersionID": 0,
        "RequestExpirationSeconds": 0,
        "OptionFlags": 0,
        "OptionFlagsUpdateMask": 0,
        "OptionVersion": 0,
        "CategoryID": 0,
        "SendClassification": null,
        "SenderProfile": null,
        "FromName": null,
        "FromAddress": null,
        "DeliveryProfile": null,
        "SourceAddressType": "DefaultPrivateIPAddress",
        "PrivateIP": null,
        "DomainType": "DefaultDomain",
        "PrivateDomain": null,
        "HeaderSalutationSource": "Default",
        "HeaderContentArea": null,
        "FooterSalutationSource": "Default",
        "FooterContentArea": null,
        "SuppressTracking": false,
        "IsSendLogging": false,
        "InteractionObjectID": null,
        "Name": "MyTriggeredSend",
        "Description": null,
        "Keyword": null,
        "Client": null,
        "PartnerKey": null,
        "PartnerProperties": null,
        "CreatedDate": "0001-01-01T00:00:00.000",
        "ModifiedDate": null,
        "ID": 0,
        "ObjectID": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
        "CustomerKey": "12345",
        "Owner": null,
        "CorrelationID": null,
        "ObjectState": null,
        "IsPlatformObject": false
    },
    {
        "ObjectID": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
        "CustomerKey": "67890",
        "Name": "MyTriggeredSend2",
        "TriggeredSendStatus": "Active",
        "TriggeredSendType": "Continuous",
        "Email": null,
        "List": null,
        "AutoAddSubscribers": false,
        "AutoUpdateSubscribers": false,
        "BatchInterval": 0,
        "BccEmail": null,
        "EmailSubject": null,
        "DynamicEmailSubject": null,
        "IsMultipart": false,
        "IsWrapped": false,
        "AllowedSlots": 0,
        "NewSlotTrigger": 0,
        "SendLimit": 0,
        "SendWindowOpen": "0001-01-01T00:00:00.000",
        "SendWindowClose": "0001-01-01T00:00:00.000",
        "SendWindowDelete": false,
        "RefreshContent": false,
        "ExclusionFilter": null,
        "Priority": null,
        "SendSourceCustomerKey": null,
        "ExclusionListCollection": null,
        "CCEmail": null,
        "SendSourceDataExtension": null,
        "IsAlwaysOn": false,
        "DisableOnEmailBuildError": false,
        "KeepExistingEmailSubject": false,
        "PreHeader": null,
        "ReplyToAddress": null,
        "ReplyToDisplayName": null,
        "DataSchemas": null,
        "TriggeredSendClass": "Standard",
        "TriggeredSendSubClass": "Standard",
        "TriggeredSendVersionID": 0,
        "RequestExpirationSeconds": 0,
        "OptionFlags": 0,
        "OptionFlagsUpdateMask": 0,
        "OptionVersion": 0,
        "CategoryID": 0,
        "SendClassification": null,
        "SenderProfile": null,
        "FromName": null,
        "FromAddress": null,
        "DeliveryProfile": null,
        "SourceAddressType": "DefaultPrivateIPAddress",
        "PrivateIP": null,
        "DomainType": "DefaultDomain",
        "PrivateDomain": null,
        "HeaderSalutationSource": "Default",
        "HeaderContentArea": null,
        "FooterSalutationSource": "Default",
        "FooterContentArea": null,
        "SuppressTracking": false,
        "IsSendLogging": false,
        "InteractionObjectID": null,
        "Description": null,
        "Keyword": null,
        "Client": null,
        "PartnerKey": null,
        "PartnerProperties": null,
        "CreatedDate": "0001-01-01T00:00:00.000",
        "ModifiedDate": null,
        "ID": 0,
        "Owner": null,
        "CorrelationID": null,
        "ObjectState": null,
        "IsPlatformObject": false
    }
]

Reference

Ressources and references related to the current methods.

SOAP object

Help me turn coffee into code

This website is provided to you free of charge. However, a lot of time and effort are spent to write, test and mainain the code. Please consider supporting my work by buying me a cup of coffee.

Last Updated: