Sunday, February 19, 2017

AX 2012 - TFS multiple workspaces

Hi All

AX 2012 support only a single TFS workspace that mean a Dynamics AX Developer Box (SQL Server, AOS, etc.) for each developer.

Many of us use a Shared AX Environment, so many Developers connected to the same Dynamics AX Environment. More details at Microsoft Dynamics AX 2012 White Paper: Developing Solutions in a Shared AOS Development Environment

For this reason Martin DrĂ¡b created a custom Solution in order to help us to achieve this result, TFS workspaces in AX2012

This solution is fantastic.
The only issue is when an object is in check-out mode also other developers can modified it also if the check-in can only be handled by the check-out Owner.

In order to fix the behavior I have created a new method and modified another one in the SysVersionControlSystemFileBased Class.

Therefore:


Create a new method like “isCheckedOut” like this:

// AddaxWorkspaces
// Denis 20170219 - Check if the current Object is check-out by the current user
boolean isCheckedOut_dlx(Filename         _filenameCurrentLayer)
{
    Set                         checkedOutObjects = new Set(Types::String);
    SysVersionControlTmpItem    items;
    SysVersionControlSystem     sysVersionControlSystem;
    SysVersionControlParameters parameters = SysVersionControlParameters::find();

    str                         checkFileName;

    sysVersionControlSystem = SysVersionControlSystem::newType(parameters.vcsType);
    sysVersionControlSystem.init(parameters);

    if (sysVersionControlSystem)
    {
        items = sysVersionControlSystem.getCheckedOutItems();

        while select items
        {
            checkFileName = items.Filename;
            checkFileName = strReplace(checkFileName, parameters.AppRoot + '$\\' + parameters.TfsProject + "\\", "");

            if ( _filenameCurrentLayer == checkFileName )
                Return True;
        }

    }

    return false;
}

Modified the allowEdit method like this:

…..
        //Has the file been checked out
        if (!bitTest(WinAPI::getFileAttributes(filenameCurrentLayer), #FILE_ATTRIBUTE_READONLY)
        &&  this.isCheckedOut_dlx(filenameCurrentLayer)       // Denis 20170219 - AddaxWorkspaces
           )
            return true;

Thanks again to Martin and Stay Tuned!


Saturday, February 4, 2017

AX 2009 – SSRS Unable to connect to http://server/ReportServer/ReportService2005.asmx

Hi Folks

As you know, starting from AX 2009 was possible to use the SSRS Report instead of the Morphx Reports.

In the last weeks, I faced an issue during the Report Deployment. The error was:

Unable to connect to http://server/ReportServer/ReportService2005.asmx as specified in the config file for the report server at C:\…\RSReportServer.config. If this url is not correct please update the config file, otherwise make sure the report server is configured correctly.


Therefore, after some investigation and with help of Microsoft Support, I have fixed the issue.

Below what verify in priority order:

1-      Check if the Antivirus is enabled and in detail the Real-time scan. Disable it or create the relative rules

2-   Update the LanguageTable Table, field LabelFile. Only the languages with 1 on the LabelFile field will be deployed
            a.       select distinct LANGUAGE, HELPLANGUAGE from USERINFO
            b.   select * into LANGUAGETABLE_Backup from LANGUAGETABLE
            c.   update LANGUAGETABLE set LabelFile = 0 where LanguageId not in ('en-us', ‘it’)               //add any language found from first query

3-     Extend timeout settings
a.       Report Manager->Site settings->Report Execution Timeout->select “do not timeout report execution”.

b.      Increase the Timeout, so:
                                                               i.      Open “C:\Program Files\Microsoft SQLServer\MSSQL\ReportingServices\ReportManager\Web.config” and “C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\Web.config”
Search for httpRuntime executionTimeout="18000"

                                                             ii.      Open “C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\rsreportserver.config”
Search for:
1.       Add Key="SQLCommandTimeoutSeconds" Value="300"
2.      Add Key="MaxActiveReqForOneUser" Value="60"
3.       Add Key="DatabaseQueryTimeout" Value="300"

                                                            iii.      Increase these values as above, Restart SSRS Services and then test it.

c.       Update machine.config to speedup .net performance
                                                               i.      In C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\MACHINE.CONFIG, replace processModel autoConfig="true" with processModel maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50"

                                                             ii.     In C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\WEB.CONFIG, locate the "system.web" Tag. Add the following as a child tag httpRuntime minFreeThreads="352" minLocalRequestFreeThreads="304" appRequestQueueLimit="5000"


Take care to make a backup of the configuration files before any modification!

Stay tuned!

Sunday, January 15, 2017

AX 2012 – TFS Build Error: The AXUtil command was started in the mode: export. Working against model store SQLServerName /ModelDatabaseName. ERROR: The file exists

Hi Guys

I am using the CodeCrib Library in order to handle my TFS Build Process.

During the last run, I faced the follow error:

Exception Message: Error exporting model: AXUtil 6.3 - Microsoft Dynamics AX Admin Utility (6.3.3000.2948) (c) Copyright, Microsoft Corporation, 2011. All rights reserved. The AXUtil command was started in the mode: export. Working against model store XXXXXX/XXXXXXX_model. ERROR: The file exists. (type Exception) Exception Stack Trace: at CodeCrib.AX.Manage.ModelStore.ExportModelShell(String modelName, String modelPublisher, String modelFile, String strongNameKeyFile) in c:\Users\xxxxxxxx\Documents\Visual Studio 2013\Projects\MainAxTFSLib\CodeCrib.AX.Manage\CodeCrib.AX.Manage\ModelStore.cs:line 144 at CodeCrib.AX.Manage.ModelStore.ExportModel(String modelName, String modelPublisher, String modelFile, String strongNameKeyFile) in c:\Users\ xxxxxxxx\Documents\Visual Studio 2013\Projects\MainAxTFSLib\CodeCrib.AX.Manage\CodeCrib.AX.Manage\ModelStore.cs:line 84 at CodeCrib.AX.TFS.ExportModel.Execute(CodeActivityContext context) in c:\Users\ xxxxxxxx\Documents\Visual Studio 2013\Projects\MainAxTFSLib\CodeCrib.AX.TFS\CodeCrib.AX.TFS\ModelStore.cs:line 96 at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
An error occurred while copying diagnostic activity logs to the drop location. Details: The file exists.

Resolution: You have to clean the TEMP folder related to the Agent User that will run the Build Process. 
Something like C:\Users\xxxxxxx\AppData\Local\Temp. After many TFS Build run, this folder contains a lot of files and an certain point the process try to create a file that already exist.

If possible, create a batch process that clean this folder at regular basis.

That is it!

Sunday, January 1, 2017

AX 2012 - TFS Build Failed, Timeout during XPO Import

Hi Guys

Let me say, start the New Year with a post is a good start. What do you say?

Back to us, if the TFS Build fail, the causes could be many.

However, from my experience if fails with a Timeout during the XPO Import (you can achieve this through the Build Txt log), the reasons can be two:


1-    Someone delete an AOT object without commit the operation on TFS. Afterward someone else create a new AOT object and add it to TFS. This one could have the same GUID of the deleted object.

2-    Someone rename an AOT object but on TFS (through TFS Solution Explorer), the object have the new name but inside the XPO is present the old name (In my opinion this is a Microsoft bug)!!!

In both case the TFS Build fails.

In order to understand which object create the issue you have to:


1-    Restore the AX Baseline Database (the DBs without any AX Customizations) on your TFS Build AX Environment
2-    Run the XPO Import process manually and verify the error
3-    Fix the error on Dynamics AX or TFS as mentioned above
4-    Rerun the TFS Build Process

Happy New Year!

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!