I have implemented couple of Automations which are calling each other using SSJS script. After every run of the Automations these are going back to "paused" state. This causes future executions thru the SSJS script to be ignored until I manually set it to "active" again after I click on "save". I have tried various schedules "None(Run Once)", "Yearly" but with same result. Can some one help me understand why the state would be going back to "paused"? I have Automations which have been set to run hourly and they do not have this problem. But the once which I invoke through SSJS seem to be showing this behavior.
When the automation is paused, trying to run thru the SSJS or the SOAP API doesn't work. I tried with below SSJS script:
Platform.Function.AddObjectArrayItem(sfp, "Value", "my_automation");
Platform.Function.SetObjectProperty(rr, "Filter", sfp);
var retrieveStatus = [0,0,0];
var automationResultSet = Platform.Function.InvokeRetrieve(rr, retrieveStatus);
var ObjectID = automationResultSet[0]["ObjectID"];
var Status = automationResultSet[0]["Status"];
if (ObjectID != "null") {
if (Status == 2 || Status == 4 || Status == 5 || Status == 6 || Status == 7) {
var obj = Platform.Function.CreateObject("Automation");
Platform.Function.SetObjectProperty(obj, "ObjectID", ObjectID);
var po = Platform.Function.CreateObject("PerformOptions");
var performResult = [0,0,0];
var performStatus = Platform.Function.InvokePerform(obj, "start", performResult, po);
}
}
but the automation that is paused doesn't run.