Friday 22 July 2016

To add the AOS service account to the debug group

Microsoft Dynamics AX Debugging Users group

Hi,
Here we will talk about Debugging users group issue.
Suppose, if you are working with a new instance in a new machine and once you do debugging you will get an error "The X++ debugger works only for users who are in the 'Microsoft Dynamics AX Debugging users' local group of windows. Get added to the group, then login again to the windows."
For fixing this issue, we need to do some kind of setup. which are as:

  1. From the Start menu, point to All Programs, click Administrative Tools, click Computer Management, and then click Local Users and Groups.
  2. In Local Users and Groups, double-click Groups, right-click Microsoft Dynamics AX Debugging Users and click Add to Group.

Detailed:

If you see this when you expected to see the debugger:


  1. Go to Control Panel -> System and Security -> Administrative tools -> Computer Management
    (To find it quickly, press the windows key on the keyboard and start typing “Computer Management”)
  2. Click on Local Users and Groups -> Groups. In the middle pane, Click on “Microsoft Dynamics AX Debugging Users”.
  3. Click on the Add button. (Users that are already added are displayed in the members block. Mine are blacked out for privacy.)
  4. In the dialog, enter the name of the user you want to add to the Microsoft Dynamics AX Debugging Users group and click on OK.
  5. Sign out and back into the Windows account.
It is possible that only the admin has rights to add users to the Microsoft Dynamics AX Debugging Users group. In that case you will have to log in with the admin account or ask the administrator to complete these steps for you.

Happy DAXing...

How to Convert Ledger dimension into Default dimension

Display Main account from LedgerDimension and convert Ledgerdimension into Defaultdimension:

Hi,
Here We will talk, how to display MainAccountId from LedgerDimension and second, how to convert LedgerDimension into DefaultDimension so that we can display financial dimensions separately....
Code will be like:
Example-1: Suppose we need to display MainAccountId from Purchase requisition detail form/Purchase requisition lines/ Financials/ Distribution amounts (AccountingDistribution table) to Purchase requisition line grid (PurchReqLine table) then code will be like...

//created by v-vimsin on 18th July 2016
//BP deviation documented
display public MainAccountNum MSDisplayLedgerDim()
{
    PurchReqTable           purchReqTableLoc;
    AccountingDistribution  accountingDistributionLoc;

    purchReqTableLoc = PurchReqTable::find(this.PurchReqTable);

    select RecId,SourceDocumentHeader,SourceDocumentLine,LedgerDimension from accountingDistributionLoc
        where  purchReqTableLoc.SourceDocumentHeader    == accountingDistributionLoc.SourceDocumentHeader
            && this.SourceDocumentLine                  == accountingDistributionLoc.SourceDocumentLine;

    return MainAccount::find(DimensionStorage::getMainAccountIdFromLedgerDimension(accountingDistributionLoc.LedgerDimension)).MainAccountId;

}


Example-1: Suppose we need to display Cost center from Purchase requisition detail form/Purchase requisition lines/ Financials/ Distribution amounts (AccountingDistribution table) to Purchase requisition line grid (PurchReqLine table) then we will convert LedgerDimension to DefaultDimension first and then return Cost center. Code will be like...

//created by v-vimsin on 18th July 2016
//BP deviation documented
display public DimensionValue MSDisplayCostCenter()
{
    PurchReqTable                   purchReqTableLoc;
    DimensionDefault                defaultdimension;
    AccountingDistribution          accountingDistributionLoc;
    DimensionAttribute              DimensionAttributeLoc;
    DimensionAttributeValue         DimensionAttributeValueLoc;
    DimensionAttributeValueSetItem  DimAttrValueSetItemLoc;

    purchReqTableLoc = PurchReqTable::find(this.PurchReqTable);

    select RecId,SourceDocumentHeader,SourceDocumentLine,LedgerDimension from accountingDistributionLoc
        where  purchReqTableLoc.SourceDocumentHeader    == accountingDistributionLoc.SourceDocumentHeader
            && this.SourceDocumentLine                  == accountingDistributionLoc.SourceDocumentLine;

    defaultdimension =  Dimensionstorage::GetDefaultDimensionfromLedgerDimension(accountingDistributionLoc.LedgerDimension);

    select RecId,Name from DimensionAttributeLoc
        join RecId,DimensionAttribute from DimensionAttributeValueLoc
        join DimAttrValueSetItemLoc
            where DimensionAttributeValueLoc.DimensionAttribute == DimensionAttributeLoc.RecId
                && DimAttrValueSetItemLoc.DimensionAttributeValue == DimensionAttributeValueLoc.RecId
                && DimAttrValueSetItemLoc.DimensionAttributeValueSet == defaultdimension
                && DimensionAttributeLoc.Name == "@SYS343410";
    return DimAttrValueSetItemLoc.DisplayValue;
}


For this time that's it.

Happy DAXing....