Skip to content

Instantly share code, notes, and snippets.

@jdeblank
Created April 18, 2019 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jdeblank/1ca869bc51282af5755516b68344cd09 to your computer and use it in GitHub Desktop.
Save jdeblank/1ca869bc51282af5755516b68344cd09 to your computer and use it in GitHub Desktop.
<script runat="server">
Platform.Load("core","1.1.1");
var prox = new Script.Util.WSProxy();
// Need to retrieve the ObjectID for the Automation, which isn't available via the SFMC interface.
var cols = ["Name", "ProgramID", "IsActive"];
var filter = {
Property: "Name",
SimpleOperator: "equals",
Value: "API trigger test"
};
var desc = prox.retrieve("Automation", cols, filter);
// Output ObjectID if you want to see it.
// Write('<br>ObjectID: ' + desc.Results[0].ObjectID);
var props = {
ObjectID: desc.Results[0].ObjectID
};
var action = "start";
var opts = {};
var res = prox.performItem("Automation", props, action, opts);
var status = res.Status;
var statusCode = res.Results[0].StatusCode;
Write("status code: " + statusCode);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment