Aaron McCausland
04/10/2025, 2:28 PMCeligo AI
04/10/2025, 2:28 PMAI generated answer (using internal Slack threads):To get the full subordinate hierarchy of a given employee using a Saved Search, you can use the 'Subsidiary' field with the 'anyof' operator and '@HIERARCHY@' value. This will match any subsidiary that matches the current user's subsidiary or any of the descendants of that subsidiary. Here is an example of how you can use it:
javascript
filters.push(new nlobjSearchFilter('subsidiary', null, 'anyof', '@HIERARCHY@'))
However, if you are running the script as an admin and want to get the results based on a specific user's subsidiary, you might need to first get the subsidiaries for the current user and then use them in the filter. Here is an example of how you can do it:
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")
]
);
After getting the subsidiaries, you can transform this search result into an array and use it as a filter in your transaction search.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
04/10/2025, 2:28 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.814868391
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81029
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80856
Celigo AI
04/10/2025, 2:28 PM