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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Get CUS layer changed properties of a table

(0) ShareShare
ReportReport
Posted on by

Hi,

I'm trying to save some documentation time by creating a script that generates technical documentation from AX. The idea is to generate a word document which describes all CUS layer changed objects (subtitles for fields, methods, properties, ...).

This works fine with the TreeNode traversal, except for the properties on table/class level.

I only seem to be able to get a list of all properties of the table, yet I am only interested in the not-default / user changed properties  (= the ones that are highlighted in bold in the properties window).

Here's a POC of the traversal job:

static void TstGetProperties(Args _args)
{
    TreeNode    table, tableCUP, tableSubCUP;
    
    TreeNodeIterator    tableIterator;
    TreeNodeTraverser   nodeTraverser;

    str         tableProp, tableCUPprop;
    
    #AOT
    ;

    
    table       = TreeNode::findNode(#TablesPath + "\\" + "CustTable");
    tableCUP    = table.getNodeInLayer(UtilEntryLevel::cus);
    
    nodeTraverser = new TreeNodeTraverser(tableCUP);
    table = nodeTraverser.next();
    
    while (table)
    {
        info(strFmt("%1, %2", nodeTraverser.infologPrefix(), nodeTraverser.currentNode().AOTgetProperties()));
        table = nodeTraverser.next();
    }
}

I would prefer to avoid reading XPO's from source control and 'scraping' those.

Any help would be greatly appreciated,

thanks,

Gabriël

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    If you get all properties when asking for CUS, can't you get properties for lower layers, compare values and ignore those that are identical?

    By the way, please separate tags with comma and don't prefix them with #. You created attached a single tag #Documentation #Layers, while you clearly means two tags Documentation and Layers.

  • Community Member Profile Picture
    on at

    Yes, taking the difference in properties between the layers is wat i was after!

    Thanks, here's the code if anyone is interested:

        TreeNode            table, tableCUP, tableISV;
    
        List                tableISVPropList;
        ListIterator        listIterISV, listIterCUS;
        
        str                 tableCUPprop, tableISVProp;
    
        #AOT
        ;
    
            
        //Table path  -- Change the table string in this line of code
        table           = TreeNode::findNode(#TablesPath + "\\" + "CustTable");
        
        //Layer-specific tablenode
        tableCUP        = table.getNodeInLayer(UtilEntryLevel::cus);
        tableISV        = table.getNodeInLayer(UtilEntryLevel::isv);
    
        //Properties in String for that table
        tableCUPprop    = tableCUP.AOTgetProperties(false, false, false);
        tableISVProp    = tableISV.AOTgetProperties(false, false, false);
        
        //Populate a list (1 property per value)
        tableISVPropList    = strSplit(tableISVProp, "\n");
        listIterISV         = new ListIterator(tableISVPropList);
        
        //Iterate over the list and subtract each ISV value from the CUS properties
        while (listIterISV.more())
        {
            tableCUPprop = strReplace(tableCUPprop, listIterISV.value(), "");
            listIterISV.next();
        }
        
        //Show the remaining CUS properties
        info(strFmt("%1", tableCUPprop));


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

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans