This topic contains 1 reply, has 0 voices, and was last updated by chanarbon 7 years, 2 months ago.

  • Author
    Posts
  • #6487 Score: 0

    grantschenck
    • Contributions: 0
    • Level 1

    Hello, we have a phone system add-on which looks up matching NS customers based on their phone numbers. This works fine from a .NET C# application with the following code:

    // Create and setup the phoneNumber search string

    SearchStringField phoneNumber = new SearchStringField();

    phoneNumber.@operator = SearchStringFieldOperator.contains;

    phoneNumber.operatorSpecified = true;

    phoneNumber.searchValue = strNumber;

    CustomerSearchBasic custSearchBasic = new CustomerSearchBasic();

    custSearchBasic.phone = phoneNumber;

    CustomerSearch custSearch = new CustomerSearch();

    custSearch.basic = custSearchBasic;

    SearchResult response = m_NSService.search(custSearch);

    We then added two custom Entity phone number fields to our Customers. I can search for matches on one of the fields like so:

    SearchStringCustomField customField6 = new SearchStringCustomField();

    customField6.@operator = SearchStringFieldOperator.contains;

    customField6.operatorSpecified = true;

    customField6.searchValue = strNumber;

    customField6.scriptId = “custentity6”;

    CustomerSearchBasic custSearchBasic = new CustomerSearchBasic();

    custSearchBasic.customFieldList = new SearchCustomField[] { customField6 };

    CustomerSearch custSearch = new CustomerSearch();

    custSearch.basic = custSearchBasic;

    I have several questions:

    1) When searching on custom fields must I provide the ID of the field? Is there any way to effectively say find me all records that match a string in ANY custom fields?

    2) How can I search for customers that either match on a predefined phone fields OR a custom field in ONE query?

    3) Similar to #2, how can I search multiple custom fields in ONE query?

    I’ve search for any examples but so far haven’t found any that combine either multiple queries into one.

    Thanks!
    This is a cached copy. Click here to see the original post.

  • #6488 Score: 0

    chanarbon
    • Contributions: 0
    • Level 1

    1. Nope. Basically, you are replicating the process in saved searches in UI and criteria in UI works that way.

    2. It is currently an enhancement to support expressions in ad-hoc searches done through SuiteTalk.

    3. To have more than one custom field as a criteria, I’d rather refer you to use Advanced Search.

    In the end, more or less RESTlets has a better fit to the use case that you have for this concern although I would require you to create a RESTlet script using SuiteScript to allow you solve the problem.

You must be logged in to reply to this topic.