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!