Fetch Hierarchical data for Product Category in Dynamics 365 Operations | CloudFronts

Fetch Hierarchical data for Product Category in Dynamics 365 Operations

Introduction:

In this blog article, we will see how we can fetch hierarchical data using X++.

How to fetch?

We will take a scenario where we will pass a category hierarchy and will fetch all categories of that hierarchy and its child category.

public class ProductCategoryHierarchy
{
    EcoResCategory    category; 

    public void ParentCategory()
    {       
        while select category where category.CategoryHierarchy == “Brands”
        {
            //code
            this.getChildrenCategory(category.RecId);
        }      
    }
    /// <summary>
    /// get categories of child product
    /// </summary>
    public void getChildrenCategory(EcoResCategoryId ParentCategory)
    {
        while select category where category.ParentCategory == ParentCategory
        {
            //code
            this.getChildrenCategory(category.RecId);
        }  
    }
 }

Share Story :

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close