This topic contains 2 replies, has 0 voices, and was last updated by michoel 7 years, 4 months ago.

  • Author
    Posts
  • #18415

    smurphy820

    I can’t seem to search by Mobile or Altphone fields on the customer record, any ideas?

    this is running on a field changed event from a client script.

    the below code results in “SSS_INVALID_SRCH_FILTER An nlobjSearchFilter contains invalid search criteria: altphone.” OR SSS_INVALID_SRCH_FILTER An nlobjSearchFilter contains invalid search criteria: mobilephone.

    Code:
    var srch = search.create({type: search.Type.CUSTOMER, filters: [[‘phone’, ‘is’, phone], ‘OR’, [‘altphone’, ‘is’, phone], ‘OR’, [‘mobilephone’, ‘is’, phone]], columns: homeSearchCols});

    var results = srch.run().getRange({start:0,end:99});
    if I remove the OR’s (i.e. mobilephone and altphone) the code runs as expected?
    This is a cached copy. Click here to see the original post.

  • #18416

    erictgrubaugh

    According to the Records Browser, neither `altphone` nor `mobilephone` is a valid Search Filter; they are only available as Search Columns.

  • #18417

    michoel

    As a workaround you can use a formula criteria:

    Code:
    var srch = search.create({
    type: search.Type.CUSTOMER,
    filters: [“formulanumeric: CASE WHEN {phone} LIKE ‘” + phone + “‘ OR {altphone} LIKE ‘” + phone + “‘ OR {mobilephone} LIKE ‘” + phone + “‘ THEN 1 ELSE 0 END”, “equalto”, “1”],
    columns: homeSearchCols
    });

You must be logged in to reply to this topic.