Monday, May 8, 2017

D365 error while uploading data via data export import framework

D365 error while uploading data via data export import framework

"no active format for data entities has been set up. Set up an active format for each dimension format type. Results Error found when validating record."

below is the resolution for same.

Create Financial dimension configuration for integrating applications matching the dimensional structure and make it active before importing a file.

Make sure to use both default and ledger dimension active in sequence of you account structure 




Friday, July 29, 2016

AOS crash, hang or memory leak debugging tools

AOS server getting crashed and need to get analyse 3 W (why when and what happen).

The first article is about the crash and Hangs Analysis tool found on the portal LCS.

The tool is well explained in the following blog: Crash and Hang analysis on LCS.

The second section describes how to collect the dump: AOS crash, hang or memory leak debugging tools.

Hope this will be helpful...

Wednesday, April 27, 2016

SQL Database restoration Issue

In the past couple of days, after restoring my database I was been experiencing unexpected shutdown occurrences in SQL and non responsive AOS service

In event log I was getting following error

sqlservr (3160) An attempt to open the file "C:\Windows\system32\LogFiles\Sum\SystemIdentity.mdb" for read / write access failed with system error 5 (0x00000005): "Access is denied. ".  The open file operation will fail with error -1032 (0xfffffbf8).

and

sqlservr (3160) Database recovery/restore failed with unexpected error -1032.

Solution for this was in KB Artical

https://support.microsoft.com/en-gb/kb/2811566

To work around this problem, add read/write permissions manually to the service accounts that are used by SQL Server (sqlservr.exe) and SQL Server Analysis Services (msmdsrv.exe) to access the \Windows\System32\LogFiles\Sum folder.

Thursday, April 14, 2016

After installing client on Windows 8.1 it crashes

During client installation we faced a issue when AX client gets crashed every time we try to start AX and the client terminates on startup after some investigation we found that is was Intel graphics drivers which were causing issue to fix this you need to Update the graphics driver to the most recent version available

Sunday, April 3, 2016

Clear your AUC files for All user.

Clear your AUC files for All user.

# Create array containing all user profile folders 
$colProfiles = Get-ChildItem "C:\Users\" -Name
$colProfiles = $colProfiles -ne "Public"
# Removes AUC files from each user profile folder 
ForEach ( $objProfile in $colProfiles ) 
{ 
    Get-ChildItem "C:\Users\$objProfile\AppData\Local\*.AUC" -force | remove-item -force
}


if you just want to clear the one user go to the following

c:\users\username\AppData\Local and clear anything ending with .AUC

AXReportInstanceExtensions COMException error message while trying to install the AX Report instance extensions through PowerShell.

AXReportInstanceExtensions COMException error message while trying to install the AX Report instance extensions through PowerShell.


Install-AXReportInstanceExtensions :
In line:1 char:1
+ Install-AXReportInstanceExtensions -ReportServerInstanceName DAXTest -Credential  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (Microsoft.Dynam...tensionsCommand:InstallReportInstanceExtensionsCommand) [I
   nstall-AXReportInstanceExtensions], COMException
    + FullyQualifiedErrorId : Microsoft.Dynamics.AX.Framework.Management.Reports.InstallReportInstanceExtensionsComman
   d

 To solve this issue you need to start the powershell as administrator and try again.

SQL Script to change logical File name for Dynamics AX Data restore

1.  Detach Database First 

USE [master]
ALTER DATABASE [OLDAXBaseline]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
EXEC master.dbo.sp_detach_db @dbname = N'OLDAXBaseline'


USE [master]
ALTER DATABASE [OLDAX]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
EXEC master.dbo.sp_detach_db @dbname = N'OLDAX'


USE [master]
ALTER DATABASE [OLDAX_model]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
EXEC master.dbo.sp_detach_db @dbname = N'OLDAX_model'

2.  Rename Database MDF and LDF files manually

3.  Create new database and Attached Manually renamed Files 

USE [master]
CREATE DATABASE AXBaseline ON
( FILENAME = N'C:\\DATA\AXBaseline.mdf'),
( FILENAME = N'C:\\DATA\AXBaseline_log.LDF')
 FOR ATTACH

USE [master]
CREATE DATABASE AX ON
( FILENAME = N'C:\\DATA\AX.mdf'),
( FILENAME = N'C:\\DATA\AX_log.LDF')
 FOR ATTACH

USE [master]
CREATE DATABASE AX_model ON
( FILENAME = N'C:\\DATA\AX_model.mdf'),
( FILENAME = N'C:\\DATA\AX_model_log.LDF')
 FOR ATTACH

4.  Change logical file name 

USE [AXBaseline]
ALTER DATABASE [AXBaseline]
      MODIFY FILE (NAME=N'OldAXBaseline', NEWNAME=N'AXBaseline')
ALTER DATABASE [AXBaseline]
      MODIFY FILE (NAME=N'OldAXBaseline_log', NEWNAME=N'AXBaseline_log')

USE [AX]
ALTER DATABASE [AX]
      MODIFY FILE (NAME=N'OldAX', NEWNAME=N'AX')
ALTER DATABASE [AX]
      MODIFY FILE (NAME=N'OldAX_log', NEWNAME=N'AX_log')

USE [AX_model]
ALTER DATABASE [AX_model]
      MODIFY FILE (NAME=N'OldAX_model', NEWNAME=N'AX_model')
ALTER DATABASE [AX_model]

      MODIFY FILE (NAME=N'OldAX_model_log', NEWNAME=N'AX_model_log')

Tuesday, March 1, 2016

SQL script Get a list of Duties and Privileges based on Security Role

SQL script Get a list of Duties and Privileges based on Security Role 

USE [Model_database_name];

SELECT secRole.AOTNAME [Role_Name], secRoleExplode.SECURITYROLE,
secRole2.AOTNAME [Subrole_Name], secRoleExplode.SECURITYSUBROLE,
secTask.AOTNAME [Task_name], secRoleTask.SECURITYTASK,
secTask2.AOTNAME [secTask2_name], secTaskExplode.SECURITYSUBTASK,
CASE
  WHEN secTask2.TYPE = 0 THEN 'Privilege'
  WHEN secTask2.TYPE = 1 THEN 'Duties'
  ELSE 'Other'
END AS OBJECTTYPE
FROM SECURITYROLE secRole
join SECURITYROLEEXPLODEDGRAPH secRoleExplode
ON secRole.RECID = secRoleExplode.SECURITYROLE
JOIN SECURITYROLE secRole2
ON secRoleExplode.SECURITYSUBROLE = secRole2.RECID
JOIN SECURITYROLETASKGRANT secRoleTask
ON secRoleExplode.SECURITYSUBROLE = secRoleTask.SECURITYROLE
JOIN SECURITYTASK secTask
ON secTask.RECID = secRoleTask.SECURITYTASK
JOIN SECURITYTASKEXPLODEDGRAPH secTaskExplode
ON secRoleTask.SECURITYTASK = secTaskExplode.SECURITYTASK
JOIN SECURITYTASK secTask2
ON secTaskExplode.SECURITYSUBTASK = secTask2.RECID
WHERE secRole.AOTNAME = ''  // Add role name here
ORDER BY OBJECTTYPE, secRoleExplode.SECURITYSUBROLE

Wednesday, July 8, 2015

Installation Management Reporter 2012 for Dynamics AX 2012 Error


During the recent installation of Management Reporter, I used the wrong Service Port(8101) in my case which was 8201 I have mistakenly put 8101. Consequently, the installation failed. The error message in the log file was:


System.ServiceModel.ProtocolException: You have tried to create a channel to a service that does not support .Net Framing. It is possible that you are encountering an HTTP endpoint. ---> System.IO.InvalidDataException: Expected record type 'PreambleAck', found '72


To Solve this error please check service endpoint port by opening config file in notepad  C: \ Program Files \ Microsoft Dynamics AX \ 60 \ Server \ MicrosoftDynamicsAX \ bin \ ax32serv.exe.config


Friday, April 3, 2015

AX2012 R3 Creating product variants using X++

static void DSCreateVarientforAllproducts(Args _args)
{
EcoResProductVariantCreationMgr ecoResProductVariantCreationMgr;
EcoResProductMaster             EcoResProductMaster;
EcoResDistinctProductVariant ecoResDistinctProductVariant;
EcoResProductReleaseManagerBase releaseManager;
args                            args;
int                             i;
    while select EcoResProductMaster 
    {
        i++;
        args = new args();
        args.record(EcoResProductMaster);

        EcoResProductVariantCreationMgr = null;

        EcoResProductVariantCreationMgr =  ecoResProductVariantCreationMgr::newFromArgs(args);
        ecoResProductVariantCreationMgr.parmCalledfromjob(true); // Added in ecoResProductVariantCreationMgr class to select all varients to release
        ecoResProductVariantCreationMgr.buildVariantSuggestions();
        ecoResProductVariantCreationMgr.run();
        EcoResProductMaster::updateVariantDescriptions(EcoResProductMaster.RecId); // To Generate Varient Descritoin of all varients
        
        select ecoResDistinctProductVariant where ecoResDistinctProductVariant.ProductMaster == EcoResProductMaster.RecId;
        if (ecoResDistinctProductVariant && !ecoResDistinctProductVariant.isReleased())
        {
            releaseManager = EcoResProductReleaseManagerBase::newFromProduct(ecoResDistinctProductVariant);
            releaseManager.release();
        }

        print i;
    }
}

Tuesday, January 27, 2015

"The internal time zone version number stored in the database is higher than the version supported by the kernel (8/7). Use a newer Microsoft Dynamics AX kernel.

"The internal time zone version number stored in the database is higher than the version supported by the kernel (8/7). Use a newer Microsoft Dynamics AX kernel

After Restoration of Database from one evironment to other we found one issue in AX 2012 R3 as

"Fatal SQL condition during login. Error message: "The internal time zone version number stored in the database is higher than the version supported by the kernel (8/7). Use a newer Microsoft Dynamics AX kernel."

Solution was simple

For the resolution you need to change the value for the column value  SYSTIMEZONESVERSION  in the table "SQLSystemVariables". if you look into the event viewer you can see that it find the value 8, but you need 7 (8/7).

Hence, 
The solution is to set the value to 7.

Select SYSTIMEZONESVERSION from SQLSystemVariables

update SQLSystemVariables
set SYSTIMEZONESVERSION = 7

Thursday, July 10, 2014

Number Sequence Error in AX 2012

While creating new number sequence we may come across this error "Default scope cannot be implicitly determined by the number sequence framework for the given datatype. Please provide scope information explicitly."

This generally comes when there is a conflict in a scope which is being entered in NumberSeqModule class and later changed fix this issue by below steps

*Please try this in testing environment first this will impact currently running number sequence as well

1. Find the EDT number which is conflicting
2. Run below job with EDT number
static void delteDatatyperef(Args _args)
{
    NumberSequenceDatatypeParameterType NumberSequenceDatatypeParameterType;
    NumberSequenceDatatype      NumberSequenceDatatype,lNumberSequenceDatatype;
    
    RefRecId    RefRecId = 105035;
    
    select NumberSequenceDatatype where NumberSequenceDatatype.DatatypeId == RefRecId;
    ttsBegin;
    delete_from NumberSequenceDatatypeParameterType where NumberSequenceDatatypeParameterType.NumberSequenceDatatype == NumberSequenceDatatype.RecId;
    delete_from lNumberSequenceDatatype where lNumberSequenceDatatype.DatatypeId == RefRecId;
    ttsCommit;
    

}

3. Run NumberSeqApplicationModule.load(); in another job as per module which is conflicting 

All will be working fine after this.



Thursday, April 17, 2014

How to change the value of a default dimension of a record in AX 2012

static void changeDimensionValue(Args _args)
{
    DimensionAttributeValueSetStorage dimensionAttributeValueSetStorage;
    DimensionAttribute dimensionAttribute;
    CustTable custTable = CustTable::find("US-014");
    DimensionValue oldDimensionValue;
    DimensionValue newDimensionValue = "011";
    DimensionDefault newDimensionDefault;

    #define.dimensionName("CostCenter")

    DimensionValue getDimensonValue(DimensionDefault _dimensionDefault)
    {
        DefaultDimensionView defaultDimensionView;
        select firstonly DisplayValue
        from defaultDimensionView
        where defaultDimensionView.Name == #dimensionName
            && defaultDimensionView.DefaultDimension == _dimensionDefault;

        return defaultDimensionView.DisplayValue;
    }

    // Get current value
    oldDimensionValue = getDimensonValue(custTable.DefaultDimension);

    // Build DimensionAttributeValueSetStorage
    dimensionAttributeValueSetStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);

    // Remove old dimension value
    dimensionAttribute = DimensionAttribute::findByName(#dimensionName);
    dimensionAttributeValueSetStorage.removeDimensionAttributeValue(
        DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, oldDimensionValue).RecId);

    // Set new dimension value
    if(newDimensionValue != "")
    {
        dimensionAttribute = DimensionAttribute::findByName(#dimensionName);
        dimensionAttributeValueSetStorage.addItem(
            DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, newDimensionValue));
    }

    newDimensionDefault = dimensionAttributeValueSetStorage.save();

    ttsbegin;
    custTable.selectForUpdate(true);
    custTable.DefaultDimension = newDimensionDefault;
    custTable.update();
    ttscommit;

}

Wednesday, July 17, 2013

Job to get the position of an employee to print

static void GetEmplPosition(Args _args)
{
   HcmWorker hcmWorker;
   HcmPositionWorkerAssignment workerAssignment;
   HcmPosition hcmPosition;
   HcmPositionDetail   hcmPositionDetail;
 
   while select recid, person from hcmWorker
       join worker, position from workerAssignment
       where workerAssignment.Worker == hcmWorker.RecId
       join recid from hcmPosition
       where hcmPosition.RecId == workerAssignment.Position
       join position, description from hcmPositionDetail
       where hcmPositionDetail.Position == hcmPosition.RecId
   {       
       info(strFmt("%1's position is %2",hcmWorker.name(), hcmPositionDetail.Description));
   }
}