Wednesday, 6 December 2017

A building block group can't be imported while any building blocks are open Error while Importing or Exporting the finance/management reports in AX 365

Recently I got the below error while importing the finance reports into my system.

A building block group can't be imported while any building blocks are open.



Solution:

Close all the active screens. So that the MR client allows the import process.



Make sure you closed all the active screens.





Wednesday, 18 October 2017

Get Unused Financial Dimensions in AX 2012

Below is the code for getting the unused financial dimensions in AX 2012.
Here I wrote code for Department.

static void finacialDimValues(Args _args)
{
    DimensionAttribute dimAttribute;
    DimensionAttributeValue dimAttributeValue;
    DimensionAttributeLevelValue dimAttributeLevelValue;
    DimensionAttributeValueGroup dimAttributeValueGroup;
    DimensionHierarchy dimHierarchy;
    Dictionary dict = new Dictionary();
    DictEnum   dictEnum = new DictEnum(enumNum(OMOperatingUnitType));
    TableId         entityId;
    RecId           entityInstance;
    DataAreaId      dataAreaId;
    RecId           financialTagCategoryId;
    TableId roleViewId;
    OMOperatingUnit oMOperatingUnit;
    DimensionAttributeValueSetItem  dimAttributeValueSetItem;
    while select oMOperatingUnit where oMOperatingUnit.OMOperatingUnitType == OMOperatingUnitType::OMDepartment
    {
        roleViewId = dict.tableName2Id(strFmt('DimAttribute%1', dictEnum.index2Symbol(oMOperatingUnit.OMOperatingUnitType)));
        [entityId, entityInstance, dataAreaId, financialTagCategoryId] = DimensionEnabledType::getFieldsForDeleteOrRename(oMOperatingUnit, roleViewId);
       // select firstOnly dimAttributeValueSetItem where dimAttributeValueSetItem.DisplayValue == oMOperatingUnit.OMOperatingUnitNumber;
         select firstonly RecId from dimAttributeLevelValue
        exists join dimAttributeValue where
            dimAttributeValue.RecId == dimAttributeLevelValue.DimensionAttributeValue &&
            dimAttributeValue.EntityInstance == entityInstance &&
            dimAttributeValue.IsDeleted == false
        exists join dimAttribute where
            dimAttribute.RecId == dimAttributeValue.DimensionAttribute &&
            dimAttribute.BackingEntityType == entityId
        exists join dimAttributeValueGroup where
            dimAttributeValueGroup.RecId == dimAttributeLevelValue.DimensionAttributeValueGroup
        notExists join dimHierarchy where
            dimHierarchy.RecId == dimAttributeValueGroup.DimensionHierarchy &&
            dimHierarchy.StructureType == DimensionHierarchyType::Focus;
        if(dimAttributeLevelValue)//dimAttributeValueSetItem)
        {
            continue;
        }
        else if(!OMMultipleHierarchy::checkExistenceInHierarchy(omOperatingUnit.RecId))
            info(oMOperatingUnit.OMOperatingUnitNumber);
    }
}


SQL query:

select * from DIMATTRIBUTEOMDEPARTMENT where not exists(
select * from DimensionAttributeLevelValue
           join DimensionAttributeValue on
            DimensionAttributeValue.RecId = DimensionAttributeLevelValue.DimensionAttributeValue and
            DimensionAttributeValue.EntityInstance = DIMATTRIBUTEOMDEPARTMENT.RECID and
            DimensionAttributeValue.IsDeleted = 0
          join DimensionAttribute on
            DimensionAttribute.RecId = DimensionAttributeValue.DimensionAttribute and
            DimensionAttribute.BackingEntityType = 11765
         join DimensionAttributeValueGroup on
            DimensionAttributeValueGroup.RecId = DimensionAttributeLevelValue.DimensionAttributeValueGroup where
        not exists(select * from DimensionHierarchy where
            DimensionHierarchy.RecId = DimensionAttributeValueGroup.DIMENSIONHIERARCHY and

            DimensionHierarchy.StructureType = 6))

@Rahul Talasila

Get unused Project categories In AX 2012

Below is the code for getting the unused project dimensions in AX.

Note : Please create a table(Test) with two string fields.


static void ProjCategory(Args _args)
{
    ProjUnpostedTransView   projUnpostedTransView;
    ProjPostTransView       projPostTransView;
    CategoryTable           categoryTable;
    Test           test;
    int iCounter;
    delete_from test;
    while select * from categoryTable
    {
        test.clear();
        select firstOnly projPostTransView where projPostTransView.CategoryId ==  categoryTable.CategoryId;
        if(projPostTransView)
        {
            continue;
        }
      //  else if(!projPostTransView)
      //  {
        select firstonly projUnpostedTransView where projUnpostedTransView.CategoryId ==  categoryTable.CategoryId;
        if(projUnpostedTransView)
        {
            continue;
        }
        else
        {
            test.AccountNum = categoryTable.CategoryId;
            test.Name = categoryTable.CategoryName;
            test.insert();
            iCounter++;
        }

SQL Query:

select * from CATEGORYTABLE where not exists
( select * from projPostTransView where CATEGORYTABLE.CategoryId =  projPostTransView.CategoryId) and 
not exists (select * from ProjLedgerJournalTransUnpostedView where CATEGORYTABLE.CategoryId =  ProjLedgerJournalTransUnpostedView.CATEGORYID)


@Rahul Talasila

Get Unused Main Accounts In AX 2012

Below is the AX code for getting the unused main accounts for a legal entity.

Note : Please create a table (TestMainaccounts) with two string fields.

static void Ledgeraccounts(Args _args)
{
    DimensionAttribute dimAttribute;
    DimensionAttributeValue dimAttributeValue;
    DimensionAttributeLevelValue dimAttributeLevelValue;
    TestMainaccounts  test;
    Ledger  Ledger;
    LedgerChartOfAccounts   ledgerChartOfAccounts;
    FiscalCalendarPeriod    fiscalCalendarPeriod;
    //OGILedgerDimensionTable oGILedgerDimensionTable;
        MainAccount                         mainAccount, mainAccountLoc; //Holds the main accounts
    GeneralJournalEntry                 generalJournalEntry; //Used to hold Ledger transactions
    GeneralJournalAccountEntry          generalJournalAccountEntry; //Used to hold Ledger transactions
    SubledgerJournalEntry               subLedgerJournalEntry; //Used to hold sub Ledger transactions (Like sales/purch invoice etc.)
    SubledgerJournalAccountEntry        subLedgerJournalAccountEntry;  //Used to hold sub Ledger transactions (Like sales/purch invoice etc.)
    DimensionAttributeValueCombination  dimAttrValueComb; //Used to store the combination of main accounts and dimensions
    int i;
    container conCompanies ;//= [ 'cm1', 'cm2', 'dat' ];
    CompanyInfo companyInfo;
    container   concreteCompanies;
    int         concreteCompanyCount;
    CompanyId   currentConcreteCompany;
    boolean     canDelete;

    SysDictTable tableToCheck;

    TableId         entityId;
    RecId           entityInstance;
    DataAreaId      dataAreaId;
    RecId           financialTagCategoryId;
    Common  _table;
    TableId _roleViewId = 0;
   // --VALIDATES NO LEDGER TRANSACTIONS HAVE BEEN POSTED.
    delete_from test;
    while select mainAccountLoc
    {
        _table = mainAccountLoc;
        [entityId, entityInstance, dataAreaId, financialTagCategoryId] = DimensionEnabledType::getFieldsForDeleteOrRename(_table, _roleViewId);

      select * FROM generalJournalAccountEntry
            JOIN dimAttrValueComb where generalJournalAccountEntry.LedgerDimension == dimAttrValueComb.RecId
            JOIN mainAccount where dimAttrValueComb.MainAccount == mainAccount.RecId
                && mainAccount.MainAccountId == mainAccountLoc.MainAccountId//"10604100"
            JOIN ledgerChartOfAccounts where mainAccount.LedgerChartOfAccounts == ledgerChartOfAccounts.RecId
            JOIN Ledger where Ledger.ChartOfAccounts == ledgerChartOfAccounts.RecId;

         select firstonly RecId from dimAttributeLevelValue
        exists join dimAttributeValue where
            dimAttributeValue.RecId == dimAttributeLevelValue.DimensionAttributeValue &&
            dimAttributeValue.EntityInstance == entityInstance &&
            dimAttributeValue.IsDeleted == false
        exists join dimAttribute where
            dimAttribute.RecId == dimAttributeValue.DimensionAttribute &&
            dimAttribute.BackingEntityType == entityId;

        if(!generalJournalAccountEntry && !dimAttrValueComb && !dimAttributeLevelValue)// && !ledgerChartOfAccounts && !Ledger)
        {
            test.clear();
            test.AccountNum = mainAccountLoc.MainAccountId;
            test.Name = LedgerChartOfAccounts::find(mainAccountLoc.LedgerChartOfAccounts).Name;
            test.insert();
            i++;
        }
    }
    info(strFmt("%1 total records", i));
}



SQL Query :
--------------

select * from MAINACCOUNT as a where not exists(
select * FROM generalJournalAccountEntry
            JOIN DimensionAttributeValueCombination on generalJournalAccountEntry.LedgerDimension = DimensionAttributeValueCombination.RecId
            JOIN MAINACCOUNT  as b on DimensionAttributeValueCombination.MainAccount = b.RecId and
b.MAINACCOUNTID = a.MAINACCOUNTID
            JOIN ledgerChartOfAccounts on b.LedgerChartOfAccounts = ledgerChartOfAccounts.RecId
            JOIN Ledger on Ledger.ChartOfAccounts = ledgerChartOfAccounts.RecId) and
        not exists( select * from DimensionAttributeLevelValue
join DimensionAttributeValue on
DimensionAttributeValue.RecId = DimensionAttributeLevelValue.DimensionAttributeValue and
DimensionAttributeValue.EntityInstance = a.RECID and
DimensionAttributeValue.IsDeleted = 0
join DimensionAttribute on
DimensionAttribute.RecId = DimensionAttributeValue.DimensionAttribute
and DimensionAttribute.BackingEntityType = 11762)

@Rahul Talasila

Wednesday, 16 August 2017

Display methods in D365 Finance Forms SSRS reports

Display method in Forms
---------------------------------------------------
In AX7 we don’t have the option to create methods on table extension, so we should use the extension class to do that. The example below will show how to create a display method on the table extension class and use on a form extension.
First create your table extension class and your display method following the example below:
1
2
3
4
5
6
7
8
9
public static class MyCustTable_Extension
{
    [SysClientCacheDataMethodAttribute(true)] //This attribute will cache your display method.
    public static display Name myDisplayName(CustTable _this)
    {
        return _this.nameAlias() + "myDisplayName"; //Do here your display method as usual.
    }
 
}
To use your display method on the form, create your new field on the form extension and use the property as below:
Capture
To cache your display method on the form set on the field the property “Cache Data Method” = yes if you don’t want to use the Attribute above.
Capture2

Display method in SSRS reports
------------------------------------------------------

f you are developing report based on query rather on based on RDP, you may want to make use of some display methods, but those may not work. “Not work” means no error in compilation or build, everything great but you may not see any results while you run the report. The returned data can be empty.

If so is the case, I would recommend to create a View and write display methods on the view. Now the display methods which are coming from View, will show you results properly. 


For more details please see below URL's.

https://shyamkannadasan.blogspot.com/2017/07/display-methods-on-ssrs-report-d365o-ax.html

https://community.dynamics.com/365/financeandoperations/b/microsoftdynamicsaxextensions/posts/display-methods-on-ssrs-report-in-msdyn365fo


Tuesday, 15 August 2017

How to disable a form control in AX 365

// <summary>
/// Created by Rahul - 08/15/2017 for disabling LogisticsPostalAddress_Street control
/// </summary>
class LogisticsPostalAddress_EventHandler
{
    /// <summary>
    /// We are disabling LogisticsPostalAddress_Street control here
    /// </summary>
    /// <param name="args"></param>
    [PostHandlerFor(formStr(LogisticsPostalAddress), formMethodStr(LogisticsPostalAddress, updateControls))]
    public static void LogisticsPostalAddress_Post_updateControls(XppPrePostArgs args)
    {
        FormRun sender = Args.getThis();
        sender.control(sender.controlId(formControlStr(LogisticsPostalAddress, LogisticsPostalAddress_Street ))).allowEdit (false);
    }

}

Or second way

[FormControlEventHandler(formControlStr(SalesTable, ButtonLineInventory), FormControlEventType::Clicked)]
    public static void ButtonLineInventory_OnClicked(FormControl sender, FormControlEventArgs e)
    {
        FormDataSource      salesLine_ds  = sender.formRun().dataSource("salesLine"); //DataSource form CustTable
        FormRun             element       = sender.formRun(); //form element
        FormControl         buttonLineInventReservation   = element.design(0).controlName("buttonLineInventReservation"); //New button on the form

        buttonLineInventReservation.enabled(false);
    }


Please refer below post also.
https://rahulmsdax.blogspot.com/2018/08/how-to-hide-form-control-in-ax-365.html

Friday, 9 June 2017

Account for transaction type Depreciation, value model XXXX, does not exist for fixed asset ######.

Reason : Main account and offset account is missing for depreciation in posting profiles

Solution :

Go to fixed asset posting profiles -> Filter ledger account by "Depreciation"

Add posting profiles for your fixed asset group



Tuesday, 18 April 2017

Recent versions of Dynamics 365 for Operations

ReleaseVersionBuild numberAvailabilitySupport end dateTo learn more
Microsoft Dynamics 365 for Operations platformPlatform update 57.0.4475.16165March 2017March 31, 2018
Microsoft Dynamics 365 for Operations platformPlatform update 47.0.4425.16161February 2017February 28, 2018
Microsoft Dynamics 365 for Operations1611 7.1.1541.3036November 2016November 30, 2019What’s new or changed in Dynamics 365 for Operations version 1611 (November 2016)
Microsoft Dynamics 365 for Operations platformPlatform update 3 7.0.4307.16141November 2016November 30, 2017What’s new or changed in Dynamics 365 for Operations platform update 3 (November 2016)
Microsoft Dynamics AX platformPlatform update 27.0.4230.16130August 2016August 31, 2017What’s new or changed in Dynamics AX platform update 2 (August 2016)
Microsoft Dynamics AX platformPlatform update 17.0.4127.16103May 2016May 31, 2017What’s new or changed in Dynamics AX platform update 1 (May 2016)
Microsoft Dynamics AX application7.0.17.0.1265.23014May 2016June 30, 2017What’s new or changed in Dynamics AX application version 7.0.1 (May 2016)
Microsoft Dynamics AX platform7.07.0.4030.16079February 2016January 31, 2017What’s new or changed in Dynamics AX 7.0 (February 2016)
Microsoft Dynamics AX application7.07.0.1265.3015February 2016June 30, 2017What’s new or changed in Dynamics AX 7.0 (February 2016)

Support matrix

The following table provides information about the multiple releases of Microsoft Dynamics 365 for Operations platform and Dynamics 365 for Operations application, and which versions are supported.
Microsoft Dynamics AX 7.0 Microsoft Dynamics AX application 7.0.1Microsoft Dynamics 365 for Operations (1611)
Platform update 5CompatibleCompatibleCompatible
Platform update 4CompatibleCompatibleCompatible
Platform update 3CompatibleCompatibleCompatible
Platform update 2CompatibleCompatible
Platform update 1CompatibleCompatible
Platform 7.0Compatible

Update policy

Microsoft Dynamics 365 for Operations is serviced as a cloud offering. Updates to the Dynamics 365 for Operations platform and application will be handled in the following manner:
  • Dynamics 365 for Operations cloud platform updates will be initiated by Microsoft. After you provide your consent, platform updates will be rolled out to provide critical updates and features to the Dynamics 365 for Operations cloud platform.
  • Dynamics 365 for Operations application updates will be initiated by you, the customer. After you provide your consent, application updates will be applied to your production environment.
Application and platform updates will be scheduled with you, the customer. When platform and application updates are released, a sandbox environment will be made available to you, so that you can validate the updates. For details about how the sandbox environment will be provided, see the licensing guide.
Important: Some updates may be mandatory and require no consent. To help protect our customers and the service, Microsoft may apply critical updates directly to your Dynamics 365 for Operations production environment. If a critical issue is discovered, the following events will occur:
  • Microsoft will notify you about the critical update.
  • Microsoft will notify you of the required downtime window (if any) and apply the critical update to your Dynamics 365 for Operations production environment.
Dynamics 365 for Operations is supported according to the Microsoft Modern Lifecycle policy, which provides consistent and predictable guidelines for product support availability.
Original Post : https://ax.help.dynamics.com/en/wiki/manage-microsoft-dynamics-ax-online-updates/

Wednesday, 5 April 2017

Chnage Session date in Microsoft Dynamics AX 7/365

Accountants would like to easy enter corrections at a month end date. For this reason in previous versions of Microsoft Dynamics AX there was an option in the Tools menu to change the session date and time. However this menu is not implemented in the new cloud based Dynamics AX, the option to change the current work date is still available. The option is even closer than you might think.

Session date

When you need to process a lot of transactions on a certain date, you can select another date to be defaulted on e.g. general journal lines. This might be a month end date, but also any other date. In the new Microsoft Dynamics AX you can access this option in two ways:
  • Date selection on dashboard Calendar control.
  • Date/time selection in the Session date and time form.

Calendar control

When Dynamics AX is opened, you will find a calendar control on the left. At startup is will be defaulted with the system date.
Session date
You can just select another date on this control to change the session date. A confirmation will be prompted to the user.
Session date
When the session date is changed, the current date and the session date both are highlighted on this calendar control.
Session date
To take advantage of this you can create e.g. a new general journal and edit the lines. You will notice that the session date will be used as default for the new journal lines.
Session date

Session date and time form

You can also change the session date by using the form Session date and time. This can be required if you also need to change the session time. Another (temporary) reason can be found at the end of this document. To open the form, click Menu > Common > Common > Session date and time.
Session date
You can then change the session date and or time. To confirm this action you must click the OK button at the bottom of this slider form.
Session date

There is more…

Currently in the Technical preview (CTP8) there is an issue when you want to select a date in another year.
Session date
So when you want to select e.g. December 31, 2015 while the computer date is in 2016, the wrong date is compiled to be your session date. The month and date is correct, but it is taken the current year (2016). So please check the proposed date carefully before accepting a wrong one.
Session date
Changing the date using the Session date and time form to another year is working, so there is a workaround for this issue. I have created Connect feedback to have Microsoft aware of this.
@Actual post : https://kaya-consulting.com/session-date-in-microsoft-dynamics-ax/

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...