I have this code that Start my automation, but I also would like to say what of steps start and finish Like : I just want that step 3 start and finish

Follow the code:

<script runat="server">


var automationCustomerKey = "XXXXXXX-XXXXXX"

var rr = Platform.Function.CreateObject("RetrieveRequest");
Platform.Function.SetObjectProperty(rr, "ObjectType", "Automation");
Platform.Function.AddObjectArrayItem(rr, "Properties", "ProgramID");
Platform.Function.AddObjectArrayItem(rr, "Properties", "CustomerKey");
Platform.Function.AddObjectArrayItem(rr, "Properties", "Status");

var sfp = Platform.Function.CreateObject("SimpleFilterPart");
Platform.Function.SetObjectProperty(sfp, "Property", "CustomerKey");
Platform.Function.SetObjectProperty(sfp, "SimpleOperator", "equals");
Platform.Function.AddObjectArrayItem(sfp, "Value", automationCustomerKey);

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") {

    Code Status
    -1   Error
     0   BuildingError
     1   Building
     2   Ready
     3   Running
     4   Paused
     5   Stopped
     6   Scheduled
     7   Awaiting Trigger
     8   InactiveTrigger

    if (Status == 2) {

        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);

    } else {

} else {
   Write("Auto not found")


1 Answer 1


No, this is not how automations can be targeted.

They are by default meant to be linear, starting at the schedule on the left.

What you want to do doesn't seem necessary to me though: set up another automation that just contains only the relevant parts, and start that one. Automations are just references / wrappers around activities. A copy of an automation will not copy the activities themselves, but reference them a second time. A change to an activity included in two /more automations will change both /all simultaneously. While this can get confusing, in your usecase, it sounds like a good thing.

on the other end of the spectrum, you can run individual activities like SQL queries without placing them inside of an automation. Not recommended as you won't get the visual run logs of an automation, but sure possible and sometimes a good thing to do. See e.g. here SSJS Update and Perform Query Definition

  • Technically if you use the undocumented REST API endpoint to do run once on auto, you can select specific steps you want run in the payload. But that is an undocumented solution and not likely something recommended for production Mar 19 at 17:49
  • :) don't have the code for this, but yeah - after all, the internal API must have some way of achieving this when picking steps for run once through the UI. Mar 21 at 7:52
  • 1
    POST /automation/v1/automations/{{autoid}}/actions/start is the endpoint and { "steps": [ { "activities": [ { "id": {{activityID}}, "IsIncludedInRun": true } ] } ] } is an example of the payload. Mar 21 at 13:01

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.