Hi, an external system is writing in a customized table in dynamics NAV (2018) (called interface table) which I process and then write an item-journal line and then post it.
I am validating the value of the fields in that interface table using try functions and in case of error I mark the record as error so the external system can retrieve it and eventually correct the error shown (for instance: Item code field is empty). This all works fine, but the problem comes when I try to post the line. I have found no way of catching eventual posting errors in order avoid an standard error message for posting (for instance: Not enough stock of product xxxx)
How can I catch the error before it raises? Try function wont work since the procedure (codeunit 22) writes into the database. "IF codeunit.run Item Jnl.-Post Line" is not allowed for similar reasons...
I have checked the preview posting for sales header, but it is kind of tricky since the "Preview" flag is all around codeunit 80 and this is not happening with 22 Item Jnl.-Post Line where I need it.
Any ideas?
0
Answers
This will enable you use try function to do posting trial and catch the error. But writes are disabled in Try functions for a good reason, so when you enable it make sure to handle the full rollback in you code manually, to ensure that there is no partially committed data left in the system
The scenario/coding could look like this : the rollback function is not READILY available but you can simulate it like this:
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
I have solved the problem. It was standard product Bug.
Page 10146 "Deposit List" in North America version has not designed properly in Demo Product. Please see below snapshot for more details.
I have designed page properly and it has solved the problem.
Cool! I will give it a try!