Showing posts with label Dynamics AX. Show all posts
Showing posts with label Dynamics AX. Show all posts

Thursday, April 24, 2014

AX 2009 Financial Dimensions Vs AX 2012 Financial Dimensions

Hi came across this very useful post which explains the technical differences in the Financial Dimensions Framework in Ax 2012. Technically its different how we use Dimensions in our customized tables in 2009/2012. Hope this helps you guys as well to get an insight of the Dimensional Framework in Ax 2012.


Earlier versions AX 2009, 4.0 :
  • In older version System use to limit the creation of dimensions up to 10. 
  • By default 3 dimensions were available in the system namely Department, CostCenter and Purpose.
    Technically these dimensions were controlled by Enum SysDimension and an array EDT Dimension.
  • So If we have 3 enum elements in SysDimension, then its corresponding array elements are stored in    dimension EDT and can be referred as Dimension[0], Dimension[1].....
  • If you would like to store these dimension values against customized table, then simply we were adding the EDT Dimension to that Table. At Form level simply drag and drop field on Group then system use to  show all the array elements as string control.
New version AX 2012 (6.0) :

  • In AX 60, their is no limit to dimension creations. One can create n number of dimensions as per    organization requirements.
  • Technically their is huge change in framework, the way these dimensions used to be created and stored.
  • Firstly EDT Dimension (array) is deprecated and replaced with DimensionDefault (Int64 RecId).    
  • Financial Dimensions master table Dimension is replaced with DimensionAttribute and DimensionValueDetails.
  • Now if one wish to store these dimension on your customized table then instead of EDT Dimension one should add DimensionDefault EDT.       
  • At Form level make use of DimensionDefaultingController class to show the available dimensions.
How to access Financial Dimensions values in AX 2012:
   
 In earlier version, accessing dimension values was very simple like
                 CustTable.Dimension[0]      ==  Department  value  
                 CustTable.Dimension[1]      ==  CostCenter  value
                 CustTable.Dimension[2]      ==  Purpose       value

 In AX 60, since they have replaced Dimension EDT with RecId DimensionDefault we have to make use of Dimension helper classes to access values.So in CustTable you will find defaultDimension field which stores reference recId for DimensionAttributeSet.    

 I am referring Customer 1101 in CEU Company, Contoso Demo Data for illustration purpose. Note the dimension values for this customer as shown in below snap.


Refer the code to access the values.

static void DEV_Dimension(Args _args)
{
    CustTable                         custTable = CustTable::find("1101");
    DimensionAttributeValueSetStorage dimStorage;
    Counter i;
    
    dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);

    for (i=1 ; i<= dimStorage.elements() ; i++)
    {
        info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,      
                               dimStorage.getDisplayValueByIndex(i)));
    }
}  
 
When you run the job, will see as below

Monday, February 24, 2014

SOLVED : A table, Extended Data Type, Base Enum or class called TableName already exists. Import of Table aborted.

If during import of XPO file, we get the following error.

 A table, Extended Data Type, Base Enum or class called TableName already exists. Import of Table aborted.

This error is basically due to cache and ID mismatch problems for the related ojbects, 

Solution
Cache files - close the client, delete files .AUC files in cache directory:
* C:\Documents and Settings\[USERNAME]\Local Settings\Application Data for Win Xp or Server 2003,
* C:\Users\[USERNAME]\AppData\Local for Vista/Win7.

...and reopen the client, tyr import again.

Hope this helps

Thursday, January 9, 2014

SOLVED : Dynamics AX 2012 R2 CU7 Installation error / DMF

When I try to install CU7 on a CU6 environment, an error appears when the new models are being imported. Check the log and there is this message:

"Error updating model database: Microsoft.Dynamics.Setup.AxSetupException: AxUtil call returned errors:The model contains a customization of a configuration key. The model cannot be imported because you can overlayer a configuration key from the patching layer only. "

Installation guide for Cumulative Update 7 (link) also warns to uninstall DMF before upgrading to CU7. This is because CU7 has DMF already now a part of the AX installation after CU 7. So if you have DIXF/DIEF installed as the stand-alone package after it went out of beta and was renamed from DMF, you should delete the corresponding AX model.
CU7_DIEF1

When you try to install without removing the model you can certainly expect this error:
CU7_DIEF2
The log file will give you the next details:

"The model contains a customization of a configuration key. The model cannot be imported because you can overlayer a configuration key from the patching layer only."

Solution:
Uninstall DMF for CU6 from Control panel / axutil

axutil delete /model:"Data Import Export Framework" from CMD .
Reinstall CU7

Monday, January 6, 2014

X++ : Filter Enum Values on Form lookup Ax 2012 / Ax 2009


Often there are requirements/ design changes, where we need to filter and display on a few enum values in a Form lookup, For this purpose we can use the following code.
This code basically filters the enum based on the values from Set.


public class FormRun extends ObjectRun
{
    SysFormEnumComboBox         sysFormEnumComboBox;
    Set                         enumSet;// = new Set(Types::Enum);
}
In init method :

enumSet= new Set(Types::Enum);
    enumSet.add(MetalType::Gold);
    enumSet.add(MetalType::Silver);
    enumSet.add(MetalType::Palladium);
    enumSet.add(MetalType::Platinum);

    sysFormEnumComboBox  = sysFormEnumComboBox::newParameters(element,element.controlId(formControlStr(TTMetalRateCreate,acunder)),enumNum(MetalType),enumSet);



Hope This Helps
happy Daxing.

Monday, December 16, 2013

SID of user from active directory / AD

    AX 2012 stores user information in the UserInfo table . While creating a new user manually/sql server, we need to specify the SID of the user. The following X++ code fetches the SID of the user from AD/ registry.

    To get SID of user, without this user will not be able to login to ax, just user will be shown into user form

    xAxaptaUserManager Axmanage;

    Axdetails = Axmanage.getSIDFromName(this.UserId,this.NetworkDomain,UserAccountType::ADUser);

Insert into USERINFO table, Ax 2012

public void insert()
{
    UserInfo userInfo,userInfo1;
    xAxaptaUserManager Axmanage;
    xAxaptaUserDetails Axdetails;

    super();

    Axmanage = new xAxaptaUserManager();
select firstonly userinfo1;

    userInfo.accountType = UserAccountType::ADUser;

    userInfo.networkAlias = userinfo1.NetworkAlias;

    userInfo.networkDomain = userinfo1.NetworkDomain;

    userInfo.id = "USERID";

    userInfo.name = "USERNAME";

    userInfo.company = userinfo1.companyid;

    userInfo.enable = this.Enabled;

// To get SID of user, without this user will not be able to login to ax, just user will be shown into user form

    Axdetails = Axmanage.getSIDFromName(this.UserId,this.NetworkDomain,UserAccountType::ADUser);

    userInfo.sid = Axdetails.getUserSid(0);

    userInfo.insert();
}

SOLVED : The specified client configuration does not contain valid WCF settings AX 2012, AX 2009

"The specified client configuration does not contain valid WCF settings". We often encounter this error when we create new client configurations for Dynamics AX. These are the steps which i followed to solve.
                                    
Do the following to fix the issue:
   Navigate to : Computer> Programs> Administrative Tools 
  1. Open the .axc where this issue was being seen in the Microsoft Dynamics AX Configuration Utility.
  2. Click on the 'Connection' tab
  3. Click on the 'Refresh' button and wait for the process to complete.Click on the 'Configure Services' 

Thursday, December 12, 2013

AX 2012 R2 CU7 Faster Compilation, Really Fast !!

AX 2012 , latest cu7 brings about a major change in the the architecture of AX compilation and build. It uses AXBuild to compile the application faster.
 You can find it in the servers bin directory (C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin on my system) One of the parameters is the number of Workers to use, this allows the compiler to use all the cores available in your system instead of 1 the traditional compile uses. But if I understand the documentation correctly AxBuild.exe is even capable itself to decide the number of workers based on the configuration it runs on. So potentially no need to specify them.
AxBuild.exe can accomplish a full compile of all X++ code, into AX p-code, many times faster than the traditional compile that you start from the MorphX client menu. AxBuild.exe is run on the Application Object Server (AOS) tier at a cmd.exe command prompt. This topic explains what AxBuild.exe does and how to use it.