My understanding from reading the documentation is that you cannot set or change the parent of a Customer record once it has been added. However, even when attempting to add a new customer and setting the parent to an existing Customer record, I get the following error:
You do not have permissions to set a value for element parent due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases.
Here is a sample of an attempt to set the parent and then add the record. This is ColdFusion cfscript which can create and make use of java objects, so you'll find the syntax to be somewhat...well, interesting.
Customer = createobject("java", "com.netsuite.webservices.lists.relationships_2_0.Customer"); Customer.setEntityId("TEST123"); Customer.setParent(getRecordRef("528", "customer")); WriteResponse = nsws.add(Customer); // nsws = NetSuiteBindingStub function getRecordRef(nInternalId) { // given a netsuite internal id and an optional string for the record type, return a netsuite RecordRef object // PARAMETERS: // nInternalId - Required. Integer or String. An internal netsuite id (all values will be converted to a string) // sRecordType - Optional. String. A string representing the RecordType of the RecordRef object (i.e. employee, customer, etc) // RETURNS: com.netsuite.webservices.platform.core_2_0.RecordRef. var RecordType = CreateObject("java", "com.netsuite.webservices.platform.core_2_0.types.RecordType"); var RecordRef = CreateObject("java", "com.netsuite.webservices.platform.core_2_0.RecordRef"); var sRecordType = ""; if (ArrayLen(Arguments) gt 1) { sRecordType = Trim(Arguments[2]); } RecordRef.setInternalId(javacast("string", nInternalId)); // setInternalId requires java String datatype; use javacast to convert if (sRecordType neq "") { // not all RecordRef objects need the RecordType set. If blank type passed, don't set RecordType RecordRef.setType(RecordType[sRecordType]); } return RecordRef; }