0

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.

1

I have built something similar, but in the IF Statement I only included status 2 ("ready"). The key to get this running is to use NO schedule, so no other statuses are set after a run. That way, a finished automation will always revert to "2" (ready) status after being called via run once with the API.

In automation studio the correct setup for the automation that you're calling looks like this:

automation source

simply pull a start event in, but make no configurations.

  • Thanks a lot @jonas, that worked like a charm!!!! I have tested it via SSJS and all my automations are getting called!!! As you said, even when there is error in automation, it moves to "Ready"(2), so we can just check "status==2". – raj Jun 3 at 10:12
0

I believe you are experiencing this behavior because your SSJS calls to execute that automation are essentially firing off the automation as a "Run Once", regardless of what it's scheduling type is. As you know, an automation that is active on a schedule cannot be executed as "Run Once" without pausing the scheduler.

You could run another automation at interval to set the status to these automations back to 'Active' (or whatever status you want). If you don't want to do this, then just modify your scripts to look for additional statuses on those automations that allow it to execute them regardless of their paused state.

  • 1
    Thanks @jason-hanshaw for quick response. I tried to trigger a paused automation using the SSJS script that I have given above but it doesn't run. If you can share sample script then that would be great! I'm also look to invoke via SOAP API... Pointers on SOAP API too is highly appreciated! – raj May 31 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.