martedì 19 aprile 2016

X++: How to find what projects an object from the AOT exists in (Recursive)

To find out what projects an AOT object exists in, use this script.
It's recursive, than it can find methods or inner nodes too

ProjectNode projectNode;
ProjectListNode projectListNode;

TreeNode treeNode;
TreeNodeIterator treeNodeIterator;

// Object we are searching for
TreeNode tnSearch = TreeNode::findNode(@'\Classes\MHT_DOCF_MasterTable');

void find(TreeNodeIterator _innerTreeNodeIterator)
{
TreeNode innerTreeNode;
;
innerTreeNode = _innerTreeNodeIterator.next();
while (innerTreeNode)
{
if (innerTreeNode.treeNodePath() == tnSearch.treeNodePath())
info(strfmt("Found in shared project %1", treeNode.AOTname()));
find(innerTreeNode.AOTiterator());
innerTreeNode = _innerTreeNodeIterator.next();
}
}

;

projectListNode = SysTreeNode::getSharedProject();
treeNodeIterator = projectListNode.AOTiterator();

treeNode = treeNodeIterator.next();
while (treeNode)
{
projectNode = treeNode;
projectNode = projectNode.loadForInspection();
find(projectNode.AOTiterator());
treeNode = treeNodeIterator.next();
}

TIP: Error executing code: The field with ID '0' does not exist in table 'SysExtensionSerializerExtensionMap'.


If you ever get "Error executing code: The field with ID '0' does not exist in table 'SysExtensionSerializerExtensionMap'." error in CIL, it may happen it is the table extension framework + the standard buf2buf function to blame.

Somehow, if you pass a Map instead of a table to buf2buf function, the following line fails:

_to.(fieldId) = _from.(fieldId);
However, if you replace this line with:

fieldName = fieldId2name(_from.TableId, fieldId);
 _to.setFieldValue(fieldName, _from.getFieldValue(fieldName));

everything is fine both in X++ and in CIL.

P.S. I didn't dare to change the standard buf2buf method. Istead, I created another method and used it in the table extension framework logic, which failed because of the issue (\Data Dictionary\Maps\SysExtensionSerializerMap\Methods\copyExtensionTableData)


Reposted: https://community.dynamics.com/ax/b/dynamicsaxnotesonthecuffs/archive/2016/04/04/error-executing-code-the-field-with-id-39-0-39-does-not-exist-in-table-39-sysextensionserializerextensionmap-39

venerdì 8 aprile 2016

HOWTO: Delete Label Files from AX 2012

Here are the steps to delete Label Files from AX 2012:

  • Create a new model. You could call it "LabelsBeGone".
  • Open the AOT and move the Label File(s) you want to get rid of to the new model.
  • Close AX and stop the AOS.
  • Use AXUtil to delete the new model.
  • Delete the label files from the server folder; C:\Program Files\Microsoft Dynamics AX\60\Server\...\bin\Application\Appl\Standard
  • Start the AOS.
  • Skip the upgrade wizard.

AX 2012: The request was aborted: Could not create SSL/TLS secure channel

The error you're encountering, "The request was aborted: Could not create SSL/TLS secure channel," can occur due to various re...