1

I am trying to fetch all the query details in a BU and able to fetch below details

Name, customerkey, targetupdatetype, createddate, modifieddate, categoryID, TargetDEname

Currently Working code:

<script runat="server">
    Platform.Load("core","1.1.5");
    var prox = new Script.Util.WSProxy();
    var cols = ["Name","CustomerKey","CategoryID","TargetUpdateType","CreatedDate","ModifiedDate","DataExtensionTarget.Name"];
    var data = prox.retrieve("QueryDefinition", cols);
    var fields = [];
    for (var i=0; i<data.Results.length; i++) {
        fields.push({
            name: data.Results[i].Name,
            customerkey: data.Results[i].CustomerKey,
            targetupdatetype: data.Results[i].TargetUpdateType,
            createddate: data.Results[i].CreatedDate,
            modifieddate: data.Results[i].ModifiedDate,
            categoryID: data.Results[i].CategoryID,
            Target: data.Results[i].DataExtensionTarget.Name
            });
    }
    var de = DataExtension.Init('B2CB596F-466B-400F-8684');
    var result = de.Rows.Add(fields);        
    Write("Result: " + result + " rows added");
</script>

Now challenging part is i want to fetch Target DE folder name! How can i do this? any help much appreciated.

2

You'd just need to do another retrieve of the DataExtension object using the DataExtensionTarget.Name in your filter.

The resulting CategoryID is the ID of the folder. Once you have that, you can retrieve the DataFolder object with that ID.

If you want to get fancy, you can build something that traverses all of the parent folder Category IDs and builds the full path.

This is the kind of thing that gets SDKs written.

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.