I have written the below code and created one test scheduled automation to start the automation. I didn't get any error when i did scheduled/publish the code but my automation is not starting. and i can see status as '2' which is ready state.
<script language="javascript" runat="server">
Platform.Load("core", "1.1.1");
try{
var cid = Platform.Function.CreateObject("ClientID");
Platform.Function.SetObjectProperty(cid, "ID", "XXXXXXXX");
Platform.Function.SetObjectProperty(cid, "IDSpecified", "true")
var rr = Platform.Function.CreateObject("RetrieveRequest");
Platform.Function.AddObjectArrayItem(rr, "ClientIDs", cid);
Platform.Function.SetObjectProperty(rr, "ObjectType", "Program");
Platform.Function.AddObjectArrayItem(rr, "Properties", "Name");
Platform.Function.AddObjectArrayItem(rr, "Properties", "ObjectID");
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", "TestRUN");
Platform.Function.SetObjectProperty(rr, "Filter", sfp);
var retrieveStatus = [0,0,0];
var automationResultSet = Platform.Function.InvokeRetrieve(rr, retrieveStatus);
Write(Stringify(automationResultSet));
var automationObjectID = automationResultSet[0]["ObjectID"];
var automationStatus = automationResultSet[0]["Status"];
Write("\n object ID::"+automationObjectID);
if (automationObjectID != "null") {
Write("in objectid if");
var obj = Platform.Function.CreateObject("Program");
Platform.Function.SetObjectProperty(obj, "ObjectID", automationObjectID);
// Platform.Function.AddObjectArrayItem(obj, "ClientID", cid);
var po = Platform.Function.CreateObject("PerformOptions");
var performResult = [0,0,0];
var performStatus = Platform.Function.InvokePerform(obj, "start", performResult, po);
} else {
Write(Stringify("automation not found"));
}
}catch(e){
Write(Stringify(e));
}
</script>