verified
Retrieve an Automation's statusLearn how to retrieve an Automation's status in Salesforce Marketing Cloud (SFMC) with SSJS (server-side JavaScript). Code snippets include the WSProxy method.
WSProxy
var api = new Script.Util.WSProxy();
var name = "MyAutomation";
var request = api.retrieve("Automation", ["Name", "CustomerKey", "Status"], {
Property: "Name",
SimpleOperator: "equals",
Value: name
});
var result = request.Results[0].Status;
<script runat="server">
Platform.Load("core", "1");
var api = new Script.Util.WSProxy();
api.setClientId({
"ID": Platform.Function.AuthenticatedMemberID(),
"UserID": Platform.Function.AuthenticatedEmployeeID()
});
try {
var name = "MyAutomation";
var request = api.retrieve("Automation", ["Name", "CustomerKey", "Status"], {
Property: "Name",
SimpleOperator: "equals",
Value: name
});
var result = request.Results[0].Status;
Write(Stringify(result));
} catch(error) {
Write(Stringify(error));
}
</script>
2
Automation statuses
Code | Status type | Message |
---|---|---|
-1 | Error | Program errored out |
0 | BuildingError | Program errored out during building |
1 | Building | Program building with activities, schedules, and other elements |
2 | Ready | Program ready to start |
3 | Running | Program running |
4 | Paused | Program paused from running state |
5 | Stopped | Program stopped |
6 | Scheduled | Program scheduled |
7 | Awaiting Trigger | Program waiting for a trigger |
8 | Inactive Trigger | Program trigger inactive |
Reference
Ressources and references related to the current methods.
Official documentation
Check trigger status
SOAP object