Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to identify form methods / data sources/ controls modified in Ax2009

Posted on by Microsoft Employee

Hello Every One,

I am working in Ax2009. I am trying to pull all the customization done in usr layer .  How to pull using x++ job, for table and classes I am able to differentiate usr or sys layer.

But where as in case of Forms like form methods / data sources i couldn't differentiate either method is newly created or sys level modified one.

Kindly help me.

Thanks,

Phani

  • ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    at 2009 ax, the forms is copied to the layer collectively, not in fragments. When you change a method of the form, the whole form will be copied to the relevant layer.

    In short, it will not be possible to determine which method of the form has changed with the code. (By comparing the layers, you can detect them.)

    The situation is a little different in table and class methods. It is possible to detect method-based layers in these objects.

    But one thing I do agree with Martin. If your goal is code upgrades, don't bother with these. Else If your goal is to simply create a list, I don't think you need to go down to the methods.

    There are many methods, if I were you, I would create a project containing the objects of a layer and make a list of the objects in that project with TreeNode (so you don't have to check the layer).

    Apart from all this information, we can help you if you explain your "purpose" more clearly. Share with us what you do and the problems you encounter.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    Well, how can you design a suitable solution if you don't know what problem you should address? A list of hundred thousand methods doesn't look very useful, therefore it sounds likely that you shouldn't be generating it all. You should forget code for a moment and ask about the business goal.

    As I said, there are already tools for code uprade that can do a much better job. Instead of listing all modified methods, for example, the system can detect actual code conflicts (places where you overlayered code which has changed in lower layers). You'll then know which places need yout attention, you'll be able to track your progress and so on. And you can ignore most methods, because those without conflicts aren't interesting.

    If you really insist, look at TreeNode and TreeNodeIterator classes (example: StackOverflow: How can I get, by code, a list of all the methods within a specific form?).

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    Hi Ergün Şahin,

    But I was able to do it Ax2012 using sysmodel element table. do you mean to say that it is not possible in ax2009?

    Thanks,

    Phani

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    Hi Martin,

    If you can give I need all layers if not we can at least restrict to usr layer only.

    Might be for code upgrade but not pretty sure.

    Thanks,

    Phani

  • Suggested answer
    ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    Apart from the utilElements element, you can also loop AOT to get layer values.(The sample code below only travels one level, but it is possible to navigate the tree.)

    daxtechies.blogspot.com/.../ax-2012-ax-2009-layers-object.html

    But it is not possible to take the layer of form methods in this way too. Form methods (different from table methods) are not based on layers anyway.
    I simply wrote a small job for testing purposes.
    The two methods of the two objects were previously untouched in the (var) layer I was on. I just touched the delete method on both objects but the incoming info (var / sys / var / var)

    static void LayerTest(Args _args)
    {
        ;
        info(enum2str(TreeNode::findNode("\\Data Dictionary\\Tables\\Address\\methods\\delete").applObjectLayer()));
        info(enum2str(TreeNode::findNode("\\Data Dictionary\\Tables\\Address\\methods\\validateWrite").applObjectLayer()));
    
        info(enum2str(TreeNode::findNode("\\Forms\\Address\\Data Sources\\Address\\Methods\\delete").applObjectLayer()));
        info(enum2str(TreeNode::findNode("\\Forms\\Address\\Data Sources\\Address\\Methods\\validateWrite").applObjectLayer()));
    }

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    Hmm, are you saying that you want list of all changes in all layers, not just in USR layer?

    What did you say it's the business requirement? Knowing the context would help us a lot...

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    Hi Martin,

    For form methods I am not able to get this.

    How to know particular form method is exist in usr and sys layer.

    Thanks,

    Phani

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    It would help if you explained your business scenario, rather then mentioning a single implementation detail (the file format). Then we could possibly suggest other solutions than the one you've designed by yourself. For example, you might want this information for upgrade purpose, not realizing that there are already tools for this purpose.

    Anyway, if you want to get this information in X , query UtilElements table. For example:

    while select utilElements
        where utilElements.utilLevel == UtilEntryLevel::usr
    {
    	// Check out Name, RecordTuype, ParentId
    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    Hi Martin,

    I am trying to collect the information and put it into one csv file. So I need to write some code that pulls the information instead of selecting project.

    Thanks,

    Phani

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: How to identify form methods / data sources/ controls modified in Ax2009

    What exactly are you trying to achieve? Maybe you don't need to write any code at all.

    If you want the list of objects, you can easily generate a project just with objects existing in USR layer (see Create a project from a specific layer).

    If you want just code defined in USR layer, you can choose a layer when exporting to .xpo (see How to: Export Application Objects by Using the AOT > To export all application objects in a layer).

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans