I am trying to create Query Definition using SSJS but its not working for me. my code as follows:
<script runat="server">
Platform.Load("Core","1.1");
var queryDef = {
Name : "Example Query Definition",
CustomerKey : "myQueryDef",
TargetUpdateType : "Overwrite",
TargetType : "DE",
Target:{
Name:"errorlog",
CustomerKey : "errorlogkey"
},
QueryText : "SELECT SubKey, Email, Name FROM [target DE] where FavoriteItemID=77"
};
var status = QueryDefinition.Add(queryDef);
var outDE=DataExtension.Init("errorlog"); // just to see the result
outDE.Rows.Add({message:status});
</script>
when i run this script using automation studio it runs but didn't create any Query :( also the status says 'ERROR' on the output..
please can some one help..
Thanks