0
<script runat="server">

Platform.Load("core", "1.1.1");

var config = {
    name: "91D16891-FEEC-4C5C-A6E9-729D7E612B5A",
    cols: ["OFFER_DK"],
    filter: {
        Property: "SCD_FLG",
        SimpleOperator: "equals",
        Value: "D"
    }
}

retrieveRecords(config);

function retrieveRecords(config) {

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

    var moreData = true,
        reqID = data = null;

    while (moreData) {

        moreData = false;

        if (reqID == null) {
            data = prox.retrieve("DataExtensionObject[" + config.name + "]", config.cols, config.filter);
        } else {
            data = prox.getNextBatch("DataExtensionObject[" + config.name + "]", reqID);
        }

        if (data != null) {
            moreData = data.HasMoreRows;
            reqID = data.RequestID;
            for (var i = 0; i < data.Results.length; i++) {
                var result_list = data.Results[i].Properties;
                
                for (k in result_list) {
                    var key = result_list[k].Name;
                    var val = result_list[k].Value
                    if (key.indexOf("_") != 0) 
                    {
                        if(key=="OFFER_DK")
                        {
                            var rowDelete = prox.deleteBatch('r_gmdr_team_offer_training',['OFFER_DK'],[val]);
                        }
                    }
                    
                }
                
            }
        }
    }
    
}
</script>
3
  • 2
    First try wrapping your code in ‘try… catch’ blocks that will allow to display the error using ‘Write(Stringify(error))’. Then go run this code on a cloud page to see the error output. Paste the error here if the extended information will not be enough for you to find what’s causing the error to occurr Commented May 8, 2023 at 4:12
  • Try also reducing the number of records being processed to see if it is potentially timing out in the 30 minute script limit. Commented May 8, 2023 at 14:28
  • @Gortonington thank you for the response. It is not showing a time-out error but a script.
    – user132577
    Commented May 8, 2023 at 16:30

0

You must log in to answer this question.

Browse other questions tagged .