0

I am trying to update a boolean column (new) using the following SSJS:

        var targetDE = DataExtension.Init(DE);
        var processing = targetDE.Rows.Update(
            {
                attempts: 0,
                status: "static line here",
                new: false,
                code:null,
                description:null
            },
            ['subscriberkey'], [key]
        );

When I run this code in a cloudpage, it returns a 500 error. As soon as I remove the new: false line it works again. I have tried also using 'false' and 0 but neither of these values work.

3

new is a reserved word/operator for JavaScript which is what is causing the miscommunication and error in your code. If you change your keys to be quoted, it should work as expected.

e.g.

        var targetDE = DataExtension.Init(DE);
        var processing = targetDE.Rows.Update(
            {
                "attempts": 0,
                "status": "static line here",
                "new": false,
                "code":null,
                "description":null
            },
            ['subscriberkey'], [key]
        );

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.