• Rudimentary conversion of a NS search result to a simple flat plain javascript object. Suitable as an argument to map()

    Returns

    a mapping function taking a NetSuite search result and returns a POJO representation of that search result. The return type will always have an 'id' property merged with type T if provided.

    Typeparam

    T declares the shape of the plain objects returned. e.g. nsSearchResult2obj<{ companyname, memo }> for a search result that has columns companyname and memo. Including an optional type here ensures strong typing on followup chained method calls.

    Example

    (using Immutable JS Sequence)

     // default (uses column labels if present)
    Seq(LazySearch.load(1234)).map(nsSearchResult2obj()).forEach(...)

    // force ignoring search column labels
    Seq(LazySearch.load(1234)).map(nsSearchResult2obj(false)).forEach(...)

    Type Parameters

    • T = {}

    Parameters

    • useLabels: boolean = true

      set to false to ignore search column labels, using the column name (internalid) instead. Defaults to true which means the property names on the returned object will match the column label names if set. If useLabels = true and no label exists, falls back to using column name. Note that label strings should be valid characters for property names (e.g. contain no ':', '-', '>' etc.)

    • addGetTextProps: boolean = true

      if true, for each column which has a truthy getText() value, include that as a 'propnameText' field similar to how nsdal behaves

    Returns ((r: search.Result) => BaseSearchResult<T>)

Generated using TypeDoc