Wednesday, August 29, 2012

Debug Assertion Failed Error

Hi Friends,

While opening the "open transaction editing" from Customer Details Form --> Functions the error raised in debug mode as
Debug assertion failed
The debug window shows the code as Debug::assert( variableName or condition)
For this i debug all the classes and table methods which are included in it and at the end luckily resolve the error.

1) Go to class CustVendOpenTransManager
2) Go to method new()
3) Comment the line this.initMarkedTransBalances(); or you can skip this line while debug this class. ( i prefer for skipping the line of code while debugging the class because editing class will leads to import export of that class which will again taking a time.)
4) The next line of code which includes this.initMarkedPayment(); execute this with F11 and further code till you get window mentioned in point 5.

I have attached the screen shot of that class and hi-lighted the line.

5) Skip all the code execution till this window appears to you. Execute the last line of code i.e.  this.refereshMarkedTransactionsBalances();

6) After this just run the remaining code of classes and you will get the following window.

7) Click on Yes and the error is resolved.

Kishor Jadhav

Tuesday, August 21, 2012

Form LedgerJournalTransCustPaym requires an active buffer.

This is a standard bug, which should be posted to MBS. 
Form LedgerJournalTransCustPaym can only be started from a "main" form like LedgerJournalTable.  Form LedgerJournalTransCustPaym check if started from main form. If not this error message is posted.

Monday, August 6, 2012

Error: Cannot create a record in . The record already exists

Thanks to Amer Atiyah.....:)
Source : Amer Atiyah's Blog

Sometimes you might face an unexpected error when trying to insert new records to any of the Dynamics AX tables. The message you might have is like: Cannot create a record in Journal lines (LedgerJournalTrans). The record already exists.
You might also have tried to check the indexes of this table that shouldn’t be duplicated. And you got surprised when you are not violating those constraints, so there is no any rational reason why this error might appear.
After so many tries, I got to fix that error by:
  1. Backing-up my database (just in case that anything went wrong)
  2. Exporting the data of that table (from the AX Import/Export functionality)
  3. Deleting/Dropping the table from the Microsoft SQL Server Management Studio (by this all the data of course will be deleted)
  4. Opening the Dynamics AX client, going to: AOT –> Data Dictionary –> Tables –> LedgerJournalTrans –> Right clieck –> Synchronize
  5. Importing the data again to all companies (from the AX Import/Export functionality.
As you could see, I got this error in a very critical table that is the LedgerJournalTrans table. This table contained already posted lines and it was really headache for me to get it fixed. But fortunately I was able to fix it by following the previous steps. :)

Friday, August 3, 2012

Sales Table to sales line update

The SalesTable2Line framwork is used in AX to update fields on the SalesLine when the corresponding field in the SalesTable was changed e.g. DevliveryMode. Follow these steps to extend the framework for your own fields.
  • Create a new field in the SalesTable and SalesLine e.g. a SalesNote field
  • Add the field to the FieldGroup HeaderToLineUpdate in the SalesTable
  • Display the new fields in the SalesTable form
  • Delete all records from the SalesTable2LineParameters table
  • Open Accounts Receivable > Settings > Parameter > "Update order line"
  • Extend the SalesTable2LineField.lineUpdateDescription method
case fieldnum(SalesTable, SalesNote): 
    return fieldid2pname(tableNum(SalesLine), fieldNum(SalesLine,SalesNote));
  • Add parm methods for the new field to AxSalesTable and AxSalesLine classes
public SalesNote parmSalesNote(SalesNote _salesNote = “) 
    if (!prmisdefault(_salesNote)) 
        this.setField(fieldnum(SalesLine, SalesNote), _salesNote); 
    return salesLine.SalesNote; 
  • Create a set method in the AxSalesLine class
protected void setSalesNote() 
    if (this.isMethodExecuted(funcname(), fieldnum(SalesLine, SalesNote))) 
    if (this.isAxSalesTableFieldsSet() || this.axSalesTable().isFieldModified(fieldnum(SalesTable, SalesNote))) 
  • Add the call of this set method in the AxSalesLine.setTableFields method