My company has created a customer record which can be associated with a customer in NetSuite. Using the webservices, I am able to get the custom record and then look in the object properties to determin the customer internal ID that the custom record is associated with.
However, I need to get the Customer record from netsuite and then see what custom records are associated with the customer. I cannot do this. The customer record does not appear to list the referecnes to custom records.
Does anyone know how to do this?
For example, this code works but I need to search the other way, from customer to custom record. This code searches for the custom record and finds the customer associated with it.
CustomRecordSearch customRecordSearch = new CustomRecordSearch(); RecordRef recordRef = new RecordRef(); recordRef.internalId = "36"; CustomRecordSearchBasic customRecordSearchBasic = new CustomRecordSearchBasic(); customRecordSearchBasic.recType = recordRef; SearchMultiSelectField f = new SearchMultiSelectField(); f.@operator = SearchMultiSelectFieldOperator.anyOf; f.operatorSpecified = true; RecordRef rr = new RecordRef(); rr.internalId = "10002170"; //I hard coded the id for the example code List<RecordRef> rrList = new List<RecordRef>(); rrList.Add(rr); f.searchValue = rrList.ToArray(); customRecordSearchBasic.internalId = f; customRecordSearch.basic = customRecordSearchBasic; SearchResult response = _service.search(customRecordSearch); Dictionary<string, string> lstInternalIDs = new Dictionary<string, string>(); foreach (com.netsuite.webservices.Record r in (response.recordList)) { foreach (com.netsuite.webservices.CustomFieldRef cf in ((com.netsuite.webservices.CustomRecord)(r)).customFieldList) { //Gets the customer associated with the PeopleSoft ID if (cf is SelectCustomFieldRef) { SelectCustomFieldRef x = ((SelectCustomFieldRef)cf); if (x.internalId == "custrecord_customer") lstInternalIDs.Add(x.internalId, x.value.ToString()); } } }