How to get the contacts attached to the partner us...
# ask-stanley-ai
c
How to get the contacts attached to the partner using suitescript 2.1
c
AI generated answer (using internal Slack threads):
To get the contacts attached to a partner using SuiteScript 2.1, you can use a saved search on the Contact record with a join on the Partner record. Here is a sample code snippet:
Copy code
javascript
var contactSearch = search.create({
   type: search.Type.CONTACT,
   filters:
   [
      ["company.internalid","anyof",partnerId]
   ],
   columns:
   [
      search.createColumn({name: "firstname"}),
      search.createColumn({name: "lastname"}),
      search.createColumn({name: "phone"})
   ]
});
var searchResult = contactSearch.run().getRange(0, 100);
In this code,
partnerId
is the internal ID of the partner record. The search will return all contacts associated with the partner, and for each contact, it will return the first name, last name, and phone number. ****** 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.852610171
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851380527
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83891207
Please provide your feedback on this answer.