Search all automations for a notification email address

Charlie Fay
1 min readApr 29, 2023

--

Although the Notifications info is technically not a retrievable field within the Automation SOAP object, it is worth noting that this object allows the use of a wildcard character “*” to retrieve all fields. This feature is particularly advantageous as it returns certain fields that were previously thought to be unattainable.

To utilize the wildcard feature, it’s essential to include "Customerkey" field in the properties or columns that you intend to retrieve, as the wildcard alone is not functional.

Using the * wildcard in conjunction with CustomerKey , Name , Description on the Automation object. This secret sauce combination will net a result inside the Notifications array within the response body, instead of it being empty. You can then take this information and log it, store it, document it, or determine which automation notification emails need updating or changing.

<script runat="server">
Platform.Load("core","1.1.1");
var prox = new Script.Util.WSProxy();

try {

var cols = [ "*", "CustomerKey", "Name", "Description"];
var filter = {Property: "Status", SimpleOperator: "IN", Value: [-1,0,1,2,3,4,5,6,7,8]};
var data = prox.retrieve("Automation", cols, filter);

//Write(Stringify(data));

var newArr = [];

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

if (data.Results[i]["Notifications"]) {

for (x=0; x<data.Results[i]["Notifications"].length; x++) {

var notificationEmail = data.Results[i]["Notifications"][x]["Address"];

var matchEmail = notificationEmail.match(/@bowerhousedigital\.com\.au/);

if (matchEmail.length > 0) {

var thisobj = {
"AutomationName" : data.Results[i]["Name"],
"notificationEmail" : data.Results[i]["Notifications"][x]["Address"]
}

newArr.push(thisobj)

}
}
} //end if
}


Write(Stringify(newArr))

} catch (e) {
Write(Stringify(e))
}

</script>

--

--

Charlie Fay
Charlie Fay

Written by Charlie Fay

I write about Salesforce Marketing Cloud, Marketing Automation, Development and Programmatic Languages. I enjoy solving complex problems with simplicity.

Responses (1)