Barnabas
03/16/2025, 4:19 PMCeligo AI
03/16/2025, 4:19 PMAI generated answer (using internal Slack threads):****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To filter products in NetSuite by subsidiary, you can use the
subsidiary
field in a search filter. Here's a general approach:
1. First, get the current user's subsidiary. You can do this by using the nlapiGetContext().getSubsidiary()
function in SuiteScript 1.0 or runtime.getCurrentUser().subsidiary
in SuiteScript 2.0.
2. Next, run a subsidiary type
search to get subsidiaries sitting under the subsidiary that the current user belongs to.
3. Transform this search result into an array.
4. Use this array as a filter in your product search.
Here's a sample code snippet in SuiteScript 1.0:
javascript
var subsidiarySearch = nlapiSearchRecord("subsidiary",null,
[
["parent","equalto","1"]
],
[
new nlobjSearchColumn("name").setSort(false),
new nlobjSearchColumn("city"),
new nlobjSearchColumn("state"),
new nlobjSearchColumn("country"),
new nlobjSearchColumn("currency")
]
);
You can also consider using the mine or descendants
filter. This filter matches any subsidiary that matches the current user's subsidiary or any of the descendants of that subsidiary. Here's how you can use it:
javascript
filters.push(new nlobjSearchFilter('subsidiary', null, 'anyof', '@HIERARCHY@'))
Please note that the @HIERARCHY@
is the internal id of the mine or descendants
filter.Celigo AI
03/16/2025, 4:20 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810311794
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810026109
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805886388
Celigo AI
03/16/2025, 4:20 PM