ANS-0581 · CUSTOMER & CRM RECORDS
How to Programmatically Attach a Contact to a Customer in NetSuite SuiteScript 2.x
Learn the SuiteScript 2.x method for establishing relationships between NetSuite records, such as linking contacts to customers or files to transactions.
Short answer
To programmatically attach a contact to a customer or other supported records in NetSuite, utilize the record.attach(options) API in SuiteScript 2.x. This function facilitates various record relationships, including linking issues to support cases, files to transactions, and custom child records to parents.
Scenario
NetSuite users often need to establish programmatic relationships between different record types, such as associating a contact with a customer, linking a file to a transaction, or attaching a custom child record to its parent. Manually creating these links can be inefficient for bulk operations or automated workflows.
Solution
The record.attach(options) API in SuiteScript 2.x provides a robust method for creating relationships between various NetSuite records. This function is supported across different SuiteScript 2.x script types, including client, user event, scheduled, and Suitelet scripts.The following attachment relationships are supported:Issue attached to Support CaseContact attached to Customer|Partner|Vendor|Lead|Prospect|ProjectFile attached to any transaction, item, activity, custom, or entity recordCustom child record attached to supported parent recordEntity to a static entity group. Note that if attaching an entity to a static entity group, you must specify entitygroup as the internal ID for the type2 argument.An example of using record.attach(options) to attach a contact to a customer would involve specifying the recordType and id of both the contact and the customer.
Expert NetSuite Support
Need help with this NetSuite issue?
Customer & CRM Records consulting and configuration support
