Sales order Posting is throwing error suddenly this morning

Hi All,

I am trying to Post a Sales order confirmation in Ax 2009 and suddenly this morning i am getting an error

Cannot create a record in Sales order header - Updating table (SalesParmSubTable). The record already exists.

This is happening in method SalesFormLetter.

protected void recordInsertListInsert()


The first call recordInsertSalesParmTable.insertDatabase() is inserting the recors in SalesParmTable and

SalesParmSubTable and the second call is actually trying to insert only in SalesparmSubTable and is erroring out.

There is no change in the code and i am trying to find what is causing this error ?

Thanks in advance,


Something probably crashed and there are orphaned records that are causing a conflict. Delete out the related records from the salesparmsubtable and salesparmsubline. They’re generated during posting. You can even delete out the salesparmtable and salesparmline records too and it’ll just get it back to scratch. I’d stick with the related sub tables first and give it a shot.

Thanks for the reply.

I tried to look at the associated related tables and coud not find any records in those tables. The only problem i see currently is the insert to SalesParmTable callwhich is inserting the record in SalesParmTable and SalesparmSubTable also. this is leading to inserting the same record in SalesParmSubTable in the next method call once again. If i comment the second call SalesparmSubsTable.DatabaseInsert() everything is working fine. I dont want to comment that code as i dont know where it will get impacted.

I’ve seen this before and because you aren’t doing anything out of the ordinary, I’m still pretty sure you just have some duplicating records. Try and delete ALL records relating to the posting you’re trying to do out of all four of those tables and maybe even check salesparmupdate too.

Whatever you tried to post recently, if you open the posting window, you should see a line with a red “X” icon. Delete that line first, then close the window, and look for any other records in those parm tables.

Hello - I am now getting this error but the strange thing is that only certain people are getting the error. I don’t believe it has anything to do with security but it doesn’t make sense that I can post the picking list but another user gets this error when they try.

How did you resolve it?

We ended up rebooting our AOS servers and it resolved the issue.