Skip to main content

Notifications

Announcements

No record found.

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!

  • Suggested answer
    Deepak Agarwal Profile Picture
    8,575 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.

  • 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

  • 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!

  • Deepak Agarwal Profile Picture
    8,575 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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,013 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans