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 . I’m looking for loading a partner record and get the sublist
c
AI generated answer (using internal Slack threads):
To get the contacts attached to a partner using SuiteScript 2.1, you can load the partner record and then access the sublist. However, it's important to note that the contacts may not be directly attached to the partner record. They might be related to the partner through another record, such as a customer or transaction record. Here is a sample code snippet that demonstrates how to load a record and access a sublist:
Copy code
javascript
var record = require('N/record');

var partnerRecord = record.load({
    type: record.Type.PARTNER, 
    id: '123'
});

var contactCount = partnerRecord.getLineCount({
    sublistId: 'contactroles' // replace 'contactroles' with the actual sublist id
});

for (var i = 0; i < contactCount; i++) {
    var contact = partnerRecord.getSublistValue({
        sublistId: 'contactroles', // replace 'contactroles' with the actual sublist id
        fieldId: 'contact', // replace 'contact' with the actual field id
        line: i
    });
    // do something with the contact
}
Please replace 'contactroles' and 'contact' with the actual sublist id and field id respectively. You can find these ids in the NetSuite Record Browser. ****** 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.855043828
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854564071
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850117624
Please provide your feedback on this answer.