Saturday, December 31, 2016

AX 2012 - One or more conflicting model elements already exists in an installed model. How to know the conflict element.

Hi All

How many times during a model installation you faced the error "One or more conflicting model elements already exists in an installed model."?

In order to install the Models usually I prefer use the Powershell command, like Install-AXModel with "-verbose" option just to see more details in case an error.

Unfortunately the "-verbose" option do not help us to find the element in conflict.

Instead, using "-verbose" option together with AxUtil resolve our issues. In this case is showed the element name that generate the conflict.



Enjoy!

Tuesday, December 27, 2016

AX 2012 – How to move DMF Setup across Enviroments

Hi Guys

Often is necessary to move the DMF Setup, without include the DMF Staging tables, from one environment to another.

How to do it?

Out of the box there isn’t any standard feature that allow you to achieve this goal.
The steps are:

1-      Retrieve a list of the DMF Setup Tables
2-      Move to another environment without broken the relation by Recid

About the first step I have created a job in order to list the DMF Setup tables.
The trick is been exclude the tables that present the EXECUTIONID field, so the staging table!

static void DMFSetupTables(Args _args)
{
    utilIdElements  utilIdElements;
    DictTable       dictTable;
    SqlDictionary   SqlDictionary;
    Map             mapTable;

    mapTable = new Map(Types::Integer, Types::Integer);

    while select utilIdElements
    where utilIdElements.recordType == UtilElementType::Table
       && utilIdElements.name like "DMF*"
    {
        dictTable = new DictTable(utilIdElements.id);
        if ( dictTable.isView()
        ||   dictTable.isTempDb()
        ||   dictTable.isTmp()
        ||   dictTable.isMap()
        ||   mapTable.exists(utilIdElements.id)
           )
            continue;
       
        Select recid from SqlDictionary where SqlDictionary.tabId == utilIdElements.id && SqlDictionary.name == "EXECUTIONID";
        If ( SqlDictionary )
            continue;

        mapTable.insert(utilIdElements.id, utilIdElements.id);
        info ( queryValue(utilIdElements.id) + "-" + utilIdElements.name );
    }
}

About the second step, I used the Test Data Transfer Tool in order to export and import the DMF Setup tables.

Therefore, I created a txt file like below with the Tables list coming from the above Job and move in the ‘[Lists]’ Folder of the TDTT Package and run the Tool.

.*(?<!^DMFCodePageValue)(?<!^DMFComparison)(?<!^DMFComparisonEntityList)(?<!^DMFComparisonLegalEntityList)(?<!^DMFComparisonReport)(?<!^DMFComparisonResults)(?<!^DMFComparisonResultsDetails)(?<!^DMFConstraintTreeLines)(?<!^DMFDataSource)(?<!^DMFDataSourceProperties)(?<!^DMFDataTypeMapping)(?<!^DMFDefinationGroupAccess)(?<!^DMFDefinitionGroup)(?<!^DMFDefinitionGroupDataArea)(?<!^DMFDefinitionGroupEntity)(?<!^DMFDefinitionGroupEntityXMLFields)(?<!^DMFEntity)(?<!^DMFEntityBaseXML)(?<!^DMFEntityDbEntityVersion)(?<!^DMFEntityDbGroup)(?<!^DMFEntityDbGroupEntity)(?<!^DMFExcelSheetLookup)(?<!^DMFExtDBSyncGroupExecution)(?<!^DMFParameters)(?<!^DMFPublishedEntity)(?<!^DMFQueryCriteria)(?<!^DMFSourceXMLToEntityMap)(?<!^DMFStagingConversionTable)(?<!^DMFStagingErrorCode)(?<!^DMFStagingTargetLink)(?<!^DMFtargetCompanyName)(?<!^DMFTargetEntityHierarchy)(?<!^DMFTargetEntityHierarchyRelation)(?<!^DMFTargetSourceName)(?<!^DMFTargetXML)(?<!^DMFTargetXMLToEntityMap)

That’s it!

Happy Christmas!

Sunday, December 11, 2016

AX 2012 - Create AX Users from a CSV file through Powershell

Hi Guys

If you want to add the AX users starting from a CSV file, here the Powershell script.
In the CSV there is the column Master where you can specify the Master user from which they are copied the security and attributes.

Is a good start and you can extend as preferred.

https://ax2012createusers.codeplex.com/

Cheers!