AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 06.05.2014, 01:16   #1  
Blog bot is offline
Blog bot
Участник
 
25,497 / 847 (79) +++++++
Регистрация: 28.10.2006
Kashperuk Ivan: Q&A session: Working with MorphX project nodes from code
Источник: http://kashperuk.blogspot.com/2014/0...x-project.html
==============

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:

X++:
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.

Источник: http://kashperuk.blogspot.com/2014/0...x-project.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось mazzy; 07.05.2014 в 10:40.
За это сообщение автора поблагодарили: wojzeh (1).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Kashperuk Ivan: Q&A session: Working with UtcDateTime from X++ Blog bot DAX Blogs 0 06.05.2014 01:16
atinkerersnotebook: Using Service Management to Track Service Orders Blog bot DAX Blogs 1 25.08.2013 19:16
emeadaxsupport: Intercompany time postings incomplete at transaction voucher level when project date differs from the day posted Blog bot DAX Blogs 0 19.08.2013 19:11
fed: Net requirements update in MRP Module and Working Set of MRP Blog bot DAX Blogs 14 08.05.2012 13:09
Вопрос про Demand Planner slava09 DAX: Функционал 4 25.09.2006 11:43

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 02:00.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.