Hi,
In my Try..Catch() block, I'm calling existing function for posting Sales Order Invoice, however when there is something happened in the invoice process, the error does not catch. For example the code is like this :
#OCCRetryCount While select myOpenSalesTable { ttsbegin; Try { SalesFormLetter formLetterObj; formLetterObj = SalesFormLetter::construct(DocumentStatus::Invoice); formLetterObj.update(myOpenSalesTable); } catch(Exception::Error) { . . retry; } catch (Exception::UpdateConflict) { . . retry; } ttscommit; }
As I put my Retry inside the catch, but because it is not "trapped" inside, the process will stop "abruptly"
I have 2 questions about this:
1. How to make the FormLetter.update() process, when it is error, also trapped in my Catch()
2. Since I included #OCCRetryCount macro in my class, while the process is inside "While..." loop, should I still need compare the number of Retry and make the process continue to the next record when error happened and already exceeded the retry account ? something like this :
catch(Exception:Error) { if(xSession::CurrentRetryCount() >= #RetryNum) { error(); continue; } else { retry; } }
Thanks,
Hi Ken,
Try this and you should be able to catch the error.
System.Exception ex; try { } catch(ex) { error(ex.Message) }
Hi Ken, Can you try adding below code at Line# 2 in the first screenshot and use xppEx in catch statement
Microsoft.Dynamics.Ax.Xpp.ErrorException xppEx;
catch(xppEx) { //infolog.text(); This will give you the error message thrown by system retry; }
Hello,
Is there anyone can help me for some advice what to do ? especially about question no.1?
I have searched at any existing article, blog, Microsoft docs, but all is confusing to me as it all only a standard usage with no further explanation about some specific issue like mine.
I can inform further as well if my question or description not that clear.
Thanks,
Hello,
Is there anyone can help me for some advice what to do ? especially about question no.1?
I have searched at any existing article, blog, Microsoft docs, but all is confusing to me as it all only a standard usage with no further explanation about some specific issue like mine.
I can inform further as well if my question or description not that clear.
Thanks,
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156