Code highlighting

Showing posts with label CreateNewProject. Show all posts
Showing posts with label CreateNewProject. Show all posts

Monday, May 05, 2014

Q&A session: Working with MorphX project nodes from code

I had some spare time today, so started answering some of the comments I had through the blog and through e-mail. I decided I'll just open up a new section on my blog, called Questions and Answers, in which I will slowly answer the questions from my backlog:

Question (related to post about the DEV_CreateNewProject tool for AX):
So could create ConfigKeys Macro and I wanted, and could throw them into the project that was created, but I can not throw them within their respective nodes, so they are loose in the project, you can help me put them within your nodes?

To summarize, Gustavo wanted to create some AOT elements from code (specifically, configuration keys and macros), and add them to a new project into respective groups, similar to how it is done in DEV_CreateNewProject tool.

I wrote a small job that does that, and can be downloaded from my OneDrive. The code is also pasted and explained below:

static void Tutorial_CreateProjWithGroupAndElement(Args _args)
{
    ProjectListNode     treeNodeProject;
    ProjectNode         upgradeNode;
    ProjectGroupNode    child;
    MacroBuild          macro;
    #AOT

    str projName = @"Project01";
    str groupName = @"macroGrp";
    str macroName = @"macro01";

    treeNodeProject = SysTreeNode::getPrivateProject();
    treeNodeProject.AOTadd(projName);
    upgradeNode = treeNodeProject.AOTfindChild(projName);
    upgradeNode = upgradeNode.getRunNode();

    upgradeNode.AOTadd(groupName);
    child = upgradeNode.AOTfindChild(groupName);
    child.projectGroupType(GroupNodeType::Macros);

    macro = new MacroBuild(macroName, true);
    macro.addSource(@"isConfigurationkeyEnabled(configurationkeynum(WMSAdvanced))");
    macro.save();

    child.addUtilNode(UtilElementType::Macro, macroName);

    upgradeNode.AOTsave();
}

  • SysTreeNode class is used to retrieve the object for the root of the Private projects node. This class contains a number of interesting methods for anyone who wants to navigate and manage AOT nodes
  • Standard AOTadd and AOTfindChild methods are used for first creating and then loading the contents of the node into a TreeNode object for processing.
  • getRunNode is used on the project node so that it is not just loaded for processing, but also opened in a new window to show the result to us after executing the job
  • MacroBuild class is used to creating new Macros, and is similar to a ClassBuild that I described previously
  • addUtilNode is the key method Gustavo was missing, and allows to add the macro created to the project group node. 
  • AOTsave() is used to persist all the changes done to the project as well as the new macro.


You can see the results immediately after executing the job.

Tuesday, May 04, 2010

Tool: DEV_SysTableBrowser and DEV_CreateNewProject tools now on AX 2009

3 or so years ago I created a couple of tools that provide extra capabilities for AX developers, specifically, ease up the creation of a new project with a predefined structure and name pattern, and add functionality to the way we browse tables with the standard SysTableBrowser, allowing to specify the exact fields you want to see, browsing temporary tables. Both tools were also available as Tabax plugins

You can read more about the tools, as well as Tabax, on the following pages on Axaptapedia:
DEV_SysTableBrowser home page on Axaptapedia
DEV_CreateNewProject home page on Axaptapedia

You can download the new versions of these tools through the pages on Axaptapedia, or directly from my SkyDrive: DEV_SysTableBrowser, DEV_CreateNewProject
If you are unfamiliar with these tools, I suggest you go through Axaptapedia, as it also contains a detailed description of the features provided.

A couple of things I would like to note:
  • There is a kernel bug in AX 2009 that heavily impacts the SysTableBrowser user experience. It takes around 10 seconds each time you want to browse the contents of a specific table. This bug was fixed with a hotfix rollup 3, so users of AX 2009 without the hotfix might have problems enjoying the DEV_SysTableBrowser tool.
  • In AX 2009 the behavior of SysTableBrowser changed a bit. Instead of re-opening the browser window each time the user changes from All fields to AutoGroup only, now 2 grids with these fields are added from the beginning, and hidden/shown based on user selection. DEV_SysTableBrowser provides much more flexibility when selecting the fields to display, so I was not able to follow the same approach. Thus, see bullet 1
  • I have not added any new AOT nodes to the template in DEV_CreateNewProject tool (Data sets, Report Libraries, etc). I don't think AX developers will invest that much time into SSRS reports and EP, and in these cases they will be able to manually create the remaining group nodes in the project.

Let me know if you have comments, suggestions or ideas for these tools.
Thanks

Monday, September 03, 2007

DEV_CreateNewProject tool version 2.0.0

Hello, everyone.

I finally got down to moving the latest version of this tool to Dynamics AX 4.0.
Now there is only one project for both versions (3.0 and 4.0)

If you haven't seen this project before, you are welcome to visit the homepage, which contains a description of the features, screenshots, installation instructions and more.

The download link with the new project is:
DEV_CreateNewProject version 2.0.0

Important:
The project was renamed to fit the naming conventions of Dynamics AX. The new name is DEV_CreateNewProject.

(If you want, you can remove the previous version (AxCreateNewProject)).
Leaving them in your application WILL NOT have unwanted effects on your system


Also, I would like to share some knowledge that came upon me today with you.
This might not seem strange to you, but it sure was a surprise for me.
While testing the new version in Dynamics AX 4.0 SP2, I noticed that the form size and position are not saved when I press OK in it.
I dug deeper into system classes and found one extra condition that was added before any data for the form is saved.

The extra condition is:
The AllowUserSetup property on form design must be Restricted or Yes.

So you should keep this in mind when developing forms in the future.

Well, have a great day, all of you.
And do try out the new DEV_CreateNewProject version.