This topic contains 5 replies, has 0 voices, and was last updated by chanarbon 8 years ago.

  • Author
    Posts
  • #1601

    MChammaTX

    Just thought I’d mention a weird quirk on trying to read search filters, I haven’t found a way to read the values property of a search filter and there is no method defined for this.

    I can see the values array in the debugger but when I try to read the property it is undefined.
    This is a cached copy. Click here to see the original post.

  • #1602

    MChammaTX

    Actually if I stringify then parse I can read the values property, just not sure why it is not officially supported.

  • #1603

    david.smith

    What script version?

  • #1604

    chanarbon

    HI MChammaTX ,

    The filter objects has toJSON() functionality that you can check filter details and from that result you can get the values array similar to this one

    Code:
    require([“N/search”], function(search){
    var mySearch = search.load({
    id : 270080
    });
    debugger;
    var filters = mySearch.filters;
    filters.forEach(function(filter){
    filterJSON = filter.toJSON()
    console.log(filterJSON.values)
    })
    })

  • #1605

    david.smith

    SS1.0 client side you can use mysearch.getFilterExpression()

  • #1606

    chanarbon

    The counterpart of mySearch.getFilterExpression() from 1.0 to 2.0 is mySearch.filterExpression which returns an array

You must be logged in to reply to this topic.