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

Fetch Hierarchical data for Product Category in Dynamics 365 Operations

For today’s modern day business that needs customer satisfaction, scalability and digital intelligence, dynamics 365 finance and operations is a complete ERP solution and is one of the most trusted software in the world without any doubt. This ERP solution helps you to innovate your products and processes so that client’s expectations can be met on time and your business can survive well in the cut-throat competition. It also gives visibility to your business across customer sales and service, marketing system and connected distribution. It simplifies production floor management, speeds up product introduction and offers flexibility in delivery alternatives. When it comes to the impact on your finance, you can gain immediate financial insights, drive corporate strategy and growth and through efficient collection management, decrease debts considerably.

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 :

Secured By miniOrange