AX 2012 – Version Control in Dynamics AX: Check-in a project and all of its pending objects programmatically

There have been times in Dynamics AX, when I have had to check in a project that includes a lot of objects. Whenever we do a new design or bug fix we always create a project and then add in all the objects that we are making changes to. When completed, we check in the project and all objects with pending changes so they are all included in the same change set.

Sometimes you have a project that is very large and you also could have a lot of other pending objects. This can make the check-in a pain. You have to go through the whole list of pending objects and select the ones that you need. There is the potential of missing objects or selecting an object that isn’t part of the project and shouldn’t be part of check-in. To help resolve or make this easier I made a modification to version control.

Steps and examples to make this small change to the SysVersionControlCheckIn form are below:

1. Go to a project you want to check in. In this example, I have a project that is checked out and some objects that are also checked out.


2. Right-click on that project and select Check In
3. On the Check-in form all objects in the project that are checked out will also be checked to be included in check in.


This is an easy and quick way to check in a project and all the objects included in that project. Instead of having to manually select each one you want to include in the check in. This will also eliminate the possibility of selecting an object that shouldn’t be part of the check in.

To include this functionality there is a small addition to the form SysVersionControlCheckedIn.

In method setSelectedAotElements I added the call to the new method.C#

void setSelectedAotElements()
    LastAotSelection lastAotSelection = new LastAotSelection();
    TreeNode treeNode;
    treeNode = lastAotSelection.first();
    element.setSelected(treeNode == null);
    while (treeNode)
        select forupdate item
            where item.ItemPath == treeNode.treeNodePath();
        if (item)
            item.Selected = true;
            // BEGIN Select all items in a project – 10/20/2016 SSI EDM
            // END Select all items in a project – 10/20/2016 SSI EDM
        treeNode =;

Created new method that will loop through the objects in a project and mark them to be checked in if the object is part of the pending object list. If the object being checked in is not a project this logic will be skipped.C#

/// <summary>
/// method will search for project file for treeNode being checked in
/// if project found it’ll loop through all project treeNodes and mark other pending objects for check in
/// </summary>
/// <param name=”_treeNode”>
/// object being set for check in
/// </param>
/// <remarks>
/// Mark all project objects for check in – 10/20/2016 SSI EDM
/// </remarks>
private void ssi_selectAllProjectItems(TreeNode _treeNode)
    // assign the project name
    ProjName          projName = _treeNode.treeNodeName();
    // get a list of shared projects
    ProjectListNode   list = infolog.projectRootNode().AOTfindChild(“@SYS71475”);
    ProjectNode       pnProj;
    // search for project being checked in
    ProjectNode       pn = list.AOTfindChild(projName);
    void searchAllObj(projectNode rootNode)
        TreeNode          childNode;
        TreeNodeIterator  rootNodeIterator;
        if (rootNode)
            rootNodeIterator = rootNode.AOTiterator();
            childNode =;
            // loop through all childNodes of project
            while (childnode)
                if (childNode.treeNodeType().id() == #NT_PROJECT_GROUP)
                    // childNode is a project group, search for next childNode
                    // object found, check to see if object is checked out
                    select forupdate item
                        where item.ItemPath == childNode.treeNodePath();
                    if (item)
                        // object is checked out, mark for check in
                        item.Selected = true;
                // load next child
                childNode =;
    // check if project was found    
    if (pn)
        // project found, loop through project treeNodes
        pnProj = pn.loadForInspection();


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di

Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...