0

I have a customer which is parents and there might be several subcustomers for this customer . This Subcustomer is a child subtab under a parent subtab(Relationships). How do i fetch or get all the subcustomers for a parent customer. I need to update some values of subcustomer based on parent customers field value.

John
  • 302
  • 2
  • 23
Winona
  • 115
  • 1
  • 17

1 Answers1

2

to get the sub customers in suitescripts you can use parent filter. For Example the below search:

var subCutsomersResults = nlapiSearchRecord('customer', null, ['parent', 'anyof', PARENT_CUSTOMER_ID], YOUR_SEARCH_COLUMNS_ARRAY);
prasun
  • 7,073
  • 9
  • 41
  • 59
  • Thanks, i created a saved search and used `nlapiSearchRecord` and got an array of subcustomers. But when i looped the array i did not know how to update the addr1,addr2 values . Also i tried your code mentioned above `11 var subCutsomersResults = nlapiSearchRecord('customer', null, ['parent', 'anyof', 930], billaddr1,billaddr2,billcity);` but there are no values in my `nlobjsearchresult` column. I need to change the address field values of child(sudcust). – Winona Dec 02 '15 at 20:55
  • to get the searchresults, please use `nlobjSearchcolumn` and field names as in the record browser https://system.na1.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2015_1/script/record/customer.html . eg: `[new nlobjSearchColumn('address1'), new nlbojSearchColumn('address2')`] – prasun Dec 03 '15 at 05:41
  • Also, to edit address details, I suggest you to see the help topic `Sample Scripts for Address Subrecords` – prasun Dec 03 '15 at 05:46
  • Thanks , But i tried all possible way. `var subCutsomersResults = nlapiSearchRecord('customer', null, ['parent', 'anyof', 930],new nlobjSearchColumn(addr1));` . 'addr1' is the subcustomer's address field. I gave it with quotes too. it throws error `ReferenceError: "addr1" is not defined`. – Winona Dec 03 '15 at 16:46
  • try `"addr1"` i.e. with quotes, should work. sometimes some keyboard or copy-paste it takes the rounded quotes not the developer quotes – prasun Dec 03 '15 at 16:55