1

I am trying to create / Update Query Definition using SSJS WSProxy method.

This is my script:

<script runat="server" >
Platform.Load("core","1.1");

  var api=new Script.Util.WSProxy();

  var qd = {
    Name : "WS_Created_Query",
    CustomerKey : "myQueryDef124579",
    TargetUpdateType : "Overwrite",
    TargetType : "DE",
    Target : {
        Name : "Counts",
        CustomerKey : "Counts-Key"
    },
    QueryText : "SELECT * from errorlog"
};


var myDE=api.createItem("QueryDefinition",qd);

</script>

but this Script not working.. can someone helps to identify the error, please. (I have a feeling QueryDefinition is not the correct object name for this method.?)

Thanks,

1 Answer 1

2

QueryDefinition is the correct object for this. However, "Target" is not a property of the QueryDefinition object of the SOAP API. So if you'd just go ahead and replace "Target" with "DataExtensionTarget", that should resolve it.

2
  • This is incorrect, you should be using "Target"
    – Brett
    Commented Dec 11, 2019 at 3:41
  • 2
    Look at the SOAP API object for Query Definition. Target is not a property, but DataExtensionTarget is. Commented Mar 30, 2020 at 2:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .