I am retrieving the status of an Automation and do not know what the status codes represent. I've seen documentation on this, but can no longer find it.
2 and 3 are being returned most frequently:
<script language="javascript" runat="server">
Platform.Load("core", "1");
// Create an API Retrieve RequestPerform request.
var RetrieveRequest = Platform.Function.CreateObject("RetrieveRequest");
// Set the request type
Platform.Function.SetObjectProperty(RetrieveRequest, "ObjectType", "Program");
// Set the columns
Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Program.Name");
Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Program.ObjectID");
Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Program.Status");
// Create a filter
var RetrieveFilter = Platform.Function.CreateObject("SimpleFilterPart");
// By ExternalKey/CustomerKey
Platform.Function.SetObjectProperty(RetrieveFilter, "Property", "CustomerKey");
Platform.Function.SetObjectProperty(RetrieveFilter, "SimpleOperator", "equals");
Platform.Function.AddObjectArrayItem(RetrieveFilter, "Value", ExternalKey);
// Add the filter to the retrieve
Platform.Function.SetObjectProperty(RetrieveRequest, "Filter", RetrieveFilter);
// Do the retrieve
var StatusAndRequestID = [0,0];
var Program = Platform.Function.InvokeRetrieve(RetrieveRequest, StatusAndRequestID);
var status = StatusAndRequestID[0];
var requestid = StatusAndRequestID[1];
//Find the ObjectID
var objectid = "";
var qd_status1 = "";
for ( var c = 0; c < Program.length; c ++ ) {
objectid = Program[c].ObjectID;
qd_status1 = Program[c].Status;
}
</script>
Output:
qd_status1: 2