Clear Form Level Error

billbasic

Member
I have a custom application that is calling the master business functions to perform a work order completion. In certain scenarios (I won’t go into details), the “End Doc” (B3100770) function returns a “Form Level” error to the application that needs to be cleared. This error is set by another business function several levels deep within “End Doc” and is set by calling the “jdeSetError” API. In the standard WO completion application (P31114) this same error occurs; however, is never displayed because “End Doc” is called in the “OK” button “Post Button Clicked” event. You’ll have to trust me (you’ve probably heard that before) but this error is not actually an issue and the WO completion is processed successfully.

In the custom application, the user must remain in the form and the error should not be displayed. For those of you that would ask, there is not a parameter on the “End Doc” function to suppress errors. I wrote a small business function (called directly after “End Doc”) to call the “jdeErrorClearEx” API; however, it does not seem to clear the error (may be to late in the process???). Any assistance would be appreciated.
 
Bill,

"Edit Doc" of B3100770 has a "Suppress Error" parameter. Pass '1' there and see if it does the magic for you.

Let us know in any case whether or not it worked for you.
 
Thanks for the reply...the "Edit Doc" is already set to 1 and currently suppresses errors generated by the "Edit Doc"; however, has no effect on the "End Doc" errors.
 
Here is one api to try: jdeErrorClearFormRecords

Not sure if it exists in all releases (it does in 8.12). I would say the lpBhvrCom->pFormHdr could be used as the first parameter. I don't know for sure what the iBeg and iEnd parms are, but I would suspect it will clear a range of errors. For example, if 4 errors are currently set and you wanted to clear the 2nd and 3rd errors, you would put 2 and 3 in those parameters.

There is also a jdeErrorGetCount (jdeErrorGetCountEx) to determine the number of errors set which may be helpful to you.

I have never used this api, so I have no idea if it works. Please let us know if you figure it out...Just yesterday I happened to have the exact same issue as you and was almost to the point where I was going to try to figure out a way to clear the form errors. Fortunately for me, by passing a certain parameter the errors did not occur.

Good luck.
 
Bill,

The API "jdeErrorClearEx" should have taken care of all the errors. I suspect that there might be something else too causing this Form Level error apart from "End Doc".

Try calling this API all the way in the end of the event instead of calling immediately after "End Doc".
 
We’ll, it looks like I’m 0 for 2...I’ll preface this by saying that I am not really much of a C developer; however, I did make several attempts at getting the jdeErrorClearFormRecords [jdeErrorClearFormRecords( LPJDEERROR_FORMHDR lpHdr, int iBeg, int iEnd );] API working; however, was never able to get it to process through successfully. It appeared that some of the information was not available in the structure (i.e. szForm which I thought should probablly be populated) and many of the parameters had errors such as “CXX0030: Error: expression cannot be evaluated”...I passed several of the parameters in (in an attempt to resolve the issues); however, was never able to get any of the error parameters populated. There are no std JDE functions using this API so I was at a loss after I made several attempts.

I also tried again calling “jdeErrorClearEx” (built into my custom business function B5598001) in a push button after all the errors were displayed on the form...it does not clear the error. I’m guessing that if I called this API in the business function that set the error it would be cleared but didn’t seem to work after the error was set to the form.

So I’m back to square 1...I’ll try to work with these functions some more tonight; however, if anyone has any in-site let me know.
 
I was able to get this issue resolved...I’m not sure if this was the best approach but it is now working the way I need it to...

1) Created a new business function to “wrap” around the “End Doc” business function...this new business function has the same (a copy of the D3100770) data structure as “End Doc”
2) Call “End Doc” within my new business function passing the parameters directly from the data structure
3) After “End Doc”, called the “jdeErrorGetCountEx” API to check for errors
4) If an error exists, called “jdeErrorClearEx” API to clear the error.

It seems as long as the jdeErrorClearEx API is called within the same BSFN that is calling “End Doc” the errors will be cleared…when called in a separate BSFN after “End Doc” it does not work. Thanks for you suggestions!
 
I had a similar issue with clearing form errors on a subform. Reading this thread made me click that I needed to set/clear the form error from the same form control.

So I created a button called FormError that sets or clears the error depending on the value of an error variable. Et voila - the error can be cleared.

As I was using the Text Substitution Error business function (B0800366) I also decided to create a custom version with a new "cClearError" variable that also clears the error.
 
Back
Top