Monday, May 5, 2014

How to run AxBuild command in AX 2012

To start a AxBuild compile, you need to have CU7 update for Ax 2012 R2, make sure that you have axbuild.exe files in

C:\Program Files\Microsoft Dynamics AX\60\Server\bin

1. Open command prompt as an administrator
2. Go to AxBuild path C:\Program Files\Microsoft Dynamics AX\60\Server\bin
3. Run below command.


AxBuild.exe xppcompileall /aos=<AOS instance number> /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\6.0\Client\Bin"


Friday, May 2, 2014

System.Runtime.InteropServices.COMException (0x80070422): The service cannot be started

While installing Dynamics AX 2012 R2  debugger I was getting this error. I started windows update service the error was resolved.

Thursday, April 3, 2014

Table 'TableName' used in report provider class should be a regular table.

This is because the RDP class extends the SRSReportDataProviderPreprocess class. to resolve this, you can do following steps:

1. Replace SRSReportDataProviderPreprocess with SRSReportDataProviderBase, but you will not be able to debug the report if it extends from SRSReportDataProviderBase.

2. Change properties of the report's tmp table CreatedBy and CreatetransactionId to 'yes', Also make the table as regular table.

Friday, November 1, 2013

How to use entry point security in x++ based on a record

I had one requirement where in Sales order form the records which are confirmed must not be allowed to edit for a user role. This can be resolved by two ways:


1. To check the current user role and making the edit button as false on a condition,override active method of datasource and code as below:

select role
        where role.Name == 'RoleName'
    join userRole
        where userRole.SecurityRole == role.RecId
            && userRole.User == curUserId();
    if(userRole && SalesTable.DocumentStatus == DocumentStatus::Confirmation)
    {
    editButtonAllow= false;
    }

2. To avoid hard coding the Roles, we can use an entry point and check users access to the entry point

we need to create a menu item with a privilege and duty assigned to a role, override active method of datasource and use the menu item as below:

SecurityRights      sr;
AccessRight         accessRight = AccessRight::View;
sr = SecurityRights::construct();

accessRight = sr.menuItemAccessRight(SecurableType::MenuItemAction,menuitemActionstr(MenuItemName));
if(accessRight == AccessRight::View && SalesTable.DocumentStatus == DocumentStatus::Confirmation)
{
    ButtonName.enabled(false);
}
 else
 {
    ButtonName.enabled(true);
  }