Dynamics AX Blog - Posts from März 2016

These posts are machine-translated.
Currently, only posts from »März 2016« are displayed Filter entfernen

Show only active employees in an employee-lookup

I recently had the requirement to integrate a new field for an employee in a table. So i created a table relation to Table HcmWorker, and added the field to the form.

Thus, a Reference Group was created and Dynamics AX generated the following lookup.

Screenshot


 
 
 

Create a list of favorites from current user

static void listFavoritesOfCurrentUser(Args _args)
{
    TreeNode treeNode;
    TreeNodeIterator iterator;
    TreeNode newTreeNode;
    int level;
    #AOT
    void loopChilds(TreeNode _treeNode)
    {
        level++;
        while(_treeNode)
        {
            info(strRep("    ", level-1) + any2str(SysLabel::labelId2String2(_treeNode.AOTname(), Global::currentUserLanguage())));
            loopChilds(_treeNode.AOTfirstChild());
            level--;
            _treeNode = _treeNode.AOTnextSibling();
        }
    }

    treeNode = infolog.userNode();
    iterator = treeNode.AOTiterator();
    treeNode = iterator.next();
    if (treeNode)
    {
        treeNode = treeNode.AOTfirstChild();
        if (treeNode)
        {
            setPrefix(treeNode.AOTname());
            loopChilds(treeNode.AOTfirstChild());
        }
    }
}

 
 
 

Read/modify registry

Following job demonstrates, how you can read/modify registry entries.

static void readWriteRegistry(Args _args)
{
    int                         regKey;
    container                   cRegValue;
    str                         regKeyValue;
    #WinApi

    // Read
    regKey = WinAPI::regOpenKey(#HKEY_CURRENT_USER, @"SoftwareMicrosoftDynamics6.0", #KEY_QUERY_VALUE);

    cRegValue = WinAPI::regGetValue(regKey, @"BuildVersion");
    if(conLen(cRegValue) > 0)
    {
        regKeyValue = conPeek(cRegValue, 1);
        info(strFmt("%1", regKeyValue));
    }

    WinAPI::regCloseKey(regKey);

    // Write
    regKey = WinAPI::regOpenKey(#HKEY_CURRENT_USER, @"SoftwareMicrosoftDynamics6.0", #KEY_QUERY_VALUE);
    cRegValue = WinAPI::regGetValue(regKey, @"BuildVersion");
    if(conLen(cRegValue) > 0)
    {
        regKey = WinAPI::regOpenKey(#HKEY_CURRENT_USER, @"SoftwareMicrosoftDynamics6.0", #KEY_WRITE);
        WinAPI::regSetValueEx(regKey, @"BuildVersion", 1, "Build: 6.3.164.0");
    }
    WinAPI::regCloseKey(regKey);
}

 
 
 

 

 
 
 
Posts of the actual month
März 2016
MoTuWeThFrSaSu
 123456
78910111213
14151617181920
21222324252627
28293031 
 
© 2006-2024 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.