I'm making a saved search for customers, as criter...
# ask-stanley-ai
l
I'm making a saved search for customers, as criteria I'm using: internal id address : address 1 address : city address : zip I'm getting two results because the customer has two addresses, the one that I'm looking for and another one, how can I get just one result? the one that I'm looking for in the criteria?
c
AI generated answer (using internal Slack threads):
In NetSuite, when you create a saved search for customers and use address fields as criteria, it will return a result for each address associated with the customer. This is because the address is a subrecord of the customer record, and each address is treated as a separate entity in the search. If you're getting multiple results because a customer has more than one address, and you want to get just one result, you need to add additional criteria to your search to narrow down the results. Here's an example of how you can do this: 1. Add a filter to your search to specify the address you're interested in. For example, if you know the 'Address 1' of the address you're interested in, you can add a filter like
Address : Address 1 is '123 Main St'
. 2. If you don't know the specific details of the address, but you know it's the default billing or shipping address, you can add a filter like
Address : Default Billing is true
or
Address : Default Shipping is true
. 3. If you're still getting multiple results, you may need to add more filters to your search to further narrow down the results. For example, you could add filters for the city, state, or zip code of the address. Here's an example of how you can create a search with these filters:
Copy code
javascript
var customerSearch = search.create({
   type: search.Type.CUSTOMER,
   filters: [
      ['internalid', 'is', '12345'],
      'and',
      ['address', 'is', '123 Main St'],
      'and',
      ['address : defaultbilling', 'is', 'true']
   ],
   columns: ['internalid', 'address']
});
This will create a search for customers with an internal ID of '12345', where the 'Address 1' is '123 Main St' and it's the default billing address. Remember to replace '12345' and '123 Main St' with the actual internal ID of the customer and the address you're interested in. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.848634
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.848108292
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842415571
Please provide your feedback on this answer.