2016-04-26

[AX2012] Error code: 38 = Filename too long

When print ssrs report VendInvoiceDocument the error showed up. It said that the filename is too long. After I checked the size of the file (my case: axapd.alt), the file was corrupted. In normal size the file size is 8KB but currently the size is 1KB. Stop the AOS and replaced the corrupted file with the normal file and then start the AOS. Well, it worked fine.

2016-04-12

[AX2012] Preview Pane on SalesTableListPage or PurchTableListpage Disapear

When you set a security on SalesTableListPage, PurchTableListPage, etc and you see no line preview pane, set the security access to line preview pane menu item. For example in SalesTableListPage form, set the security access to SalesTableListPagePreviewPane menu item.

2016-04-11

[AX2012] The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

Error message showed when SSRS report was opened : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

Solution: Check windows and router firewall.

2016-03-21

[AX2012] Ax error "A user session on the server could not be created. Try to start the client again. If the problem continues contact Ax Administrator"

I checked the Event viewer and found that the log file was full:
Object Server 01:  The database reported (session 1 (-AOS-)): [Microsoft][SQL Server Native Client 10.0][SQL Server]The transaction log for database
'AXDatabase' is full due to 'LOG_BACKUP'. . The SQL statement was: "UPDATE SQLSYSTEMVARIABLES SET VALUE='34' WHERE PARM='SYSVARID'"

Solution:
Stop the AOS.
Shrink database log file and start the AOS.

2016-03-20

[AX2012] Enable/Disable Buttons on PurchTable or SalesTable Form by Code

To enable or disable buttons on PurchTableListPage, PurchTable, SalesTableListPage or SalesTable form, you can edit on these classes:
  • PurchTableListPageInteraction
  • PurchTableInteraction
  • PurchTableInteractionHelper
  • SalesTableListPageInteraction
  • SalesTableInteraction
  • SalesTableInteractionHelper
You can add some additional code to enable or disable buttons, for example buttonConfirm in PurchaseTable form. Find this button name in PurchTableInteraction class and add your code.
These class can affect PurchTableListPage or SalesTableListPage forms.

2016-03-17

[AX2012] QR Code

Here is the sample to generate QR Code in AX 2012. This code can be used for report by save the binData.getData() into container field in report temporary table. You can download the xpo here.

public class FormRun extends ObjectRun
{
    Microsoft.Dynamics.QRCode.Encoder   qrCode;
    System.Drawing.Bitmap               netBitmap;
    BinData                             binData;
    Image                               image;
}


public void init()
{
    super();
    qrCode = new Microsoft.Dynamics.QRCode.Encoder();
   
qrCode.set_Version(40);
 qrCode.set_ErrorCorrectionLevel(Microsoft.Dynamics.QRCode.ErrorCorrectionLevel::High);
    binData = new BinData();
    image   = new Image();
}


void createQR()
{
    Filename            filename;
    FileIOPermission    perm = null;
    ;

    netBitmap   = qrCode.Encode(Text.text());
    filename    = qrCode.GetTempFile(Text.text());
    perm        = new FileIOPermission(filename, 'RW');
    perm.assert();

    binData.loadFile(filename);
    image.setData(binData.getData());//binData.getData() return a container
    QRImage.image(image);
    if(WinAPI::fileExists(filename))
    {
        WinAPI::deleteFile(filename);
    }
    CodeAccessPermission::revertAssert();

    //info(filename);
}


public void textChange()
{
    super();
    element.createQR();
}

2016-03-16

[AX2012] SSRS Report Error at The Fisrt Time After Restarting AOS



"The DefaultValue expression for the report parameter ‘AX_CompanyName’ contains an error: Request for the permission of type ‘System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed. (rsRuntimeErrorInExpression)"

Solution:
  1. Go to System administration>Setup>System>System service accounts.
  2. Retype the business connector proxy account ("domain\username").