How can i attach a contact to a child customer in ...
# ask-stanley-ai
n
How can i attach a contact to a child customer in netsuite via API ?
c
AI generated answer (using internal Slack threads):
To attach a contact to a child customer in NetSuite via API, you can use the
record.attach
method in SuiteScript. This method is used to build links between records. Here are the steps you need to follow: 1. Create both the contact and customer records separately. 2. Use the
record.attach
method to link the contact to the customer. Here is a sample code snippet:
Copy code
javascript
var contactId = record.submitFields({
    type: record.Type.CONTACT,
    values: {
        firstname: 'Test',
        lastname: 'Test'
    }
});

var customerId = record.submitFields({
    type: record.Type.CUSTOMER,
    values: {
        companyname: 'Test Company'
    }
});

record.attach({
    record: {
        type: 'contact',
        id: contactId
    },
    to: {
        type: 'customer',
        id: customerId
    }
});
In this code: -
record.submitFields
is used to create the contact and customer records. -
record.attach
is used to link the contact to the customer. Please note that the customer record type should not be 'individual' as individual customers are considered as contacts themselves in NetSuite. ****** 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.831665158
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826110959
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820068479
Please provide your feedback on this answer.