Question

I'm currently working on a system that will export all the nodes from my AX 2009 AOT to individual XPO files, for the purpose of tracking changes in a central version control repository. I'm having a fair amount of luck, but for some reason I cannot get the Forms or Data Sets node to export at all.

This is my current code set:

private void export(str parentNode)
{
    TreeNode            node, parent;
    str                 folderName;
    Set                 permissions = new Set(Types::Class);
    ;

    folderName = exportBaseDir + parentNode;

    permissions.add(new FileIoPermission(folderName, "r"));
    permissions.add(new InteropPermission(InteropKind::ClrInterop));

    CodeAccessPermission::assertMultiple(permissions);

    //Create Filesystem Folder if needed
    if (!WinApiServer::pathExists(folderName))
        System.IO.Directory::CreateDirectory(folderName);


    CodeAccessPermission::revertAssert();

    parent = TreeNode::findNode(parentNode);

    if (parent)
        node = parent.AOTfirstChild();
    else
        warning(strfmt("Could not parse node: %1", parentNode));

    while (node)
    {
        this.exportNode(node);
        node = node.AOTnextSibling();
    }
}

When I call export(@"\Forms"); or export(@"\Data Sets"); I get a "Could not parse node" message, meaning the TreeNode::findNode() didn't resolve correctly. Running it on any other node (such as Classes) does not have this issue. This also only happens when it is run in a Batch -- running it with the client (with the CodeAccessPermission parts removed) will export all nodes as expected.

Is there something that would prohibit Forms and Data Sets from being accessed from within a Batch? If so, what can I do to access those nodes?

Était-ce utile?

La solution

As far as I can tell it's a server/client issue/bug. The easy solution would be to create this method on your class:

client static TreeNode clientTreeNode(str _path)
{
    return TreeNode::findNode(_path);
}

Then in your code, below the parent = TreeNode::findNode(parentNode); line, put:

parent = parent ? parent : YourClassHere::clientTreeNode(parentNode);

And that should solve your issue. You'll have a bit of digging to do in order to find out why it doesn't work on the server tier if you just must know.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top