I need to get all childrens (and its childrens) for a parent product category
example:
Parent
-- child 1
-- child 2
---- child 2.1
---- child 2.2
-- child 3
I am using the EcoResCategory.getChildren()
method but it gets the first children only.
"but it gets the first children only"
I don't think that is correct. If you take a look at the references of the EcoResCategory.getChildren()
method, there is method WarrantyLookupProcessingJob.updateLookupCategory()
that shows the following pattern:
EcoResCategory childCategory = parentCategory.getChildren();
while (childCategory)
{
next childCategory;
}
The next
keyword retrieves the next record from the childCategory
table buffer. See also https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-data/xpp-select
Also note that the getChildren
method has a _levelLimit
parameter with the following documentation:
An <c>EcoResCategoryLevel</c> value that indicates the maximum level of children categories to retrieve.