searchnetsuiterestletsuitescript2.0

How to create a search filter expression with a 'not equal to' condition in a NetSuite RESTlet?


I'm new to JavaScript and to NetSuite as well. I'm trying to create a search with filters expressions but NetSuite is throwing an error in the condition 'not equal to'. This is my code:

           search
            .create({
              type: search.Type.JOB,
              filters: [
                [
                  "externalid",
                  search.Operator.IS,
                  childProject.ClassExternalId,
                ],
                "and",
                ["parent", search.Operator.NOTEQUALTO, 142],
              ],
              columns: ["externalid"],
            })

Script Execution Log

Title: SSS_INVALID_SRCH_OPERATOR

Detail: An nlobjSearchFilter contains an invalid operator, or is not in proper syntax: parent.

I've also tried this with the same result: ["parent", search.Operator.ISNOT, 142]

So my question is:

How do I tell NetSuite to search 'jobs' with 'externalid' === childProject.ClassExternalId and 'parent' !== 142?

Thanks


Solution

  • Parent field would be a record / list type.

    Try using "NONE OF" operator in the filter for Parent field.