DictTable object not initialized error when deleting pending invoices


I am using ax 2012.

I am trying to delete the pending invoice in purchase order module and getting the following error.

The pending invoices are not visible in the AP>Enquires>History>Invoice history and Matching tables. But it is present in the VendInvoiceInfoTable.

I tried deleting it from the table I still get the same error. I can able to delete it by writing a job using dodelete(), but i want a permanent solution for this.

When I get the sourceDocumentHeader from the vendInvoiceInfo table and when I check in Accounting Distribution I can find 2 records related to it. If i delete those records I can able to delete the invoice from the front end.

Bu its not best practice to delete records from accounting distribution .

Someone can help me with any alternatives?


Anything deleting directly form the table is not suggested. Rather you should identify the route cause and fix it (so that it will allow you to delete from the User interface).
How this invoice is been created?
Have you tried to investigate, why it is not showing in AP>Enquires>History>Invoice history and Matching tables?
What is the value of this.SourceRelationType ?
dictTable = new DictTable(this.SourceRelationType);

I tired to identify the route cause but couldn’t able achieve where things are going wrong. "this.SourceRelationType"is a field . SourceRelationType is a field from sourceDocumentLine table which contains the tableID value.

Invoice are created by the standard ways only. There is no special flow in creating invoice

Yes its a field. I was asking what value you are getting in that field while debugging. (as it is unable to create the DictTable object based on that value)

It actually runs 4 times and for the first 3 times I am getting values of vendInvoiceInfo table(twice) and purchorderInvoice table once the 4th time I am getting a null value

I would back trace and check why the null value comes…

On checking in sourceDocumentLine table find method returns a null value . But the passed recId value is present in the table but still it returns null value

Hi Kranthi,
Any suggestions…

This is something, that i don’t understand.

Try creating a similar PO, follow similar steps and see what happens? Also compare records in sourceDocument tables.

When I am creating new PO,I can able to delete without any errors.

That’s fine, but asking to check or compare the records in source document tables for new PO and the PO with the error.