I am trying to search for records which contain either a value or is empty using SSJS using the following line but it doesn't yield any results.

var Filter = {Property:"status",SimpleOperator:"IN",Value:["pending", null]};

Can anyone explain how I could do this correctly?


1 Answer 1


I believe you would need to make this into a complex filter as the IN will not recognize the null as a value to match on and will never return a value of true.

SFMC is (to simplify) utilizing SQL for these filters and SQL utilizes Three-value logic, which essentially means that you cannot use operators like =, !=, >, <,etc. to match on Null as Null compared to anything will return Null which will fail the filter (requires a returned value of true to pass).

So you will need to utilize the built in Null operators in order to grab those associated. See below for example of utilizing this logic.

var Filter = {
    LeftOperand: {
        Property: "status",
        SimpleOperator: "equals",
        Value: "pending"
    LogicalOperator: "OR",
    RightOperand: {
        Property: "status",
        SimpleOperator: "isNull"

You must log in to answer this question.

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