I'm currently building an integration with Netsuite using the Suitetalk REST API. I would like to retrieve the role of each contact associated with a customer to find the Primary and Operational contacts of the customer.
I have tried querying the customer endpoint:
record/v1/customer/ {customerId} /contact/ {contactId} /contactrole
This query returns Role id 14 which is 'Customer Center' for all customer contact records. This is obviously incorrect as this information is returned for contacts tagged with different roles when I check them via the UI.
I have also tried using Suiteql using the query endpoint with the similar results.
Is the query incorrect or should I be using a different endpoint? I have been stuck for days, so I would appreciate any suggestion.
UPDATE
I managed to get the customer contact roles via the following SuiteQL query:
{
"q" : "SELECT Contact.email, Contact.entityid, ContactRole.name as role FROM Customer LEFT JOIN CustomerCompanyContact ON ( CustomerCompanyContact.ContactsCompany = Customer.ID ) LEFT JOIN Contact ON ( CustomerCompanyContact.contact = Contact.ID ) LEFT JOIN ContactRole ON ( Contact.ContactRole = ContactRole.id ) WHERE ContactRole.name IN ('Primary Contact','Operational contact') AND Customer.entityid IN ('exampleCompanyId') ORDER BY Contact.datecreated DESC"
}