web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Is it possible to move a category from one parent to another in Category Hierarchy through code?

(0) ShareShare
ReportReport
Posted on by

For example, would it be possible to move commodity code "Test1" from "TESTSummCommCode" to TESTSummCommCode2"?

I looked into methods of EcoResCategory table but there doesn't seem to be a method that can be used for this. Update method doesn't work properly if I change the parent category of a commodity code. And the AddToHierarchy method throws a validation error that parent category cannot be changed. Has anyone tried to accomplish something like copying the commodity code record, deleting it from wrong parent category and adding it under the right parent category?

Category-Hierarchy.JPG

Apologies for posting this in AX 2012 forum even though the snapshot is from D365FO because this works quite similar in both versions but AX 2012 has more active user base.

Thank you for your time!

I have the same question (0)
  • Deepak Agarwal Profile Picture
    8,585 on at
    RE: Is it possible to move a category from one parent to another in Category Hierarchy through code?

    Hello,

    May I know whats the business needs to do this. Ideally, you should be able to delete a category and create the same in another header.

  • Community Member Profile Picture
    on at
    RE: Is it possible to move a category from one parent to another in Category Hierarchy through code?

    agarwal AX So I need to do this because the product records come through integration and they already have commodities codes on them. But the summary commodity codes/parent categories come through another integration. So some commodity codes may not have parent category when they get created and so they sit under some generic parent category. And when the actual parent category finally gets created, the related commodity codes need to move from generic to actual parent automatically after the actual parent categories are created via batch job. So that is the business need. Thanks!

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at
    RE: Is it possible to move a category from one parent to another in Category Hierarchy through code?

    Hi GNJ,

    Can you think about any other feasible integration option?

    I am asking because the categories are shared across companies and trying to code something might result in problems in other companies and/or modules.

    Rather than fixing the problem afterwards I wonder if there is something that you could do with your integrations and how they are initially created.

    Best regards,

    Ludwig

  • Suggested answer
    Deepak Agarwal Profile Picture
    8,585 on at
    RE: Is it possible to move a category from one parent to another in Category Hierarchy through code?

    I see. How about having another integration (maybe inward only) to get all categories in F&O first then get their relevant transactions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,004

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 857 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 548 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans