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

Notifications

Announcements

Community site session details

Community site session details

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

How to Identify Unused Code or Elements

(2) ShareShare
ReportReport
Posted on by 97

Hello,


I’m looking for a way to identify unused code or elements in D365FO, such as tables, enums, classes, etc.
Additionally, is it possible to find these unused elements on a model basis? If so, what tools, techniques, or best practices would you recommend?
Any guidance or tips would be greatly appreciated. Thanks in advance!
 

Regards,
Categories:
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,042 Super User 2025 Season 2 on at
     
    To know if the element is used or not you can right click on the element, click find all references, if it doesn't have any reference, so you know it is not used.
     
     
     
     
     
    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

  • Layan Jwei Profile Picture
    8,133 Super User 2025 Season 2 on at
    Hi D365FO Explorer,

    As far as I'm aware there is no straight forward way to get the result of everything not being used.

    As waed said, you will need to go to each AOT element, and right click "find references"
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,529 Super User 2025 Season 2 on at
    I agree with below.
     
    Thanks
    Ramesh
     
     
  • D365Explorer Profile Picture
    97 on at
    Hello Waed, Layan, and Ramesh,

    Thanks a lot for your replies, really appreciate the help.

    I’m aware of the "Find References" option by right-clicking an element, but as you know, that works one element at a time. The challenge I’m facing is that I don't know exactly which elements might be unused, and checking them one-by-one would take a lot of time across a big custom model.

    I’m hoping to find a way to scan an entire model and get a list (even if it's not 100% perfect) that shows potentially unused AOT elements or logic. Even an approximate result would be super helpful and save a lot of effort.
    If you know of any tools, scripts, or any other ways to do a broader search across a model, please let me know.

    Thanks again for your time and support!

    Best regards,
  • André Arnaud de Calavon Profile Picture
    301,403 Super User 2025 Season 2 on at
    Hi D365Explorer,
     
    There is no option to scan for unused elements. If the cross-references are updated for the custom model, the data is stored in a SQL database. You can try to query that database and get a count of references per object. This is still cumbersome as there might be an unused table having an unused form and also unused classes with some X++ coding referring to the unused table. 
  • D365Explorer Profile Picture
    97 on at
    Hi Andre,
     
    Thankyou for the clarification.
     
    I have a related question:

    I’m currently working on a code upgrade project. During the upgrade, some elements are no longer being used because parts of the logic have been re-written to align with D365FO standards, and some references have been modified to meet specific requirements.
    In this situation, what would be the recommended approach to refactor and safely remove the old unused references and elements?
    Is there any general approach you would suggest for identifying and cleaning up unused code during an code upgrade?
     
    Regards,

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 679 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 264 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans