E9.2 Interactive Application - How is End Dialog Executed?



I am in the process of refactoring a bunch of applications/NERS/batch applications for an upcoming enhancement release for our users and I came across an application that was developed a long time ago by some contractors. In this application they use a work table to store a lot of data that is processed in many NERS before it is displayed in a grid which is pretty common. However, I noticed that there are over 2 million files sitting in the work table, leading me to believe that the application was either not attempting to clear out the work table, or it was failing to do so due to incorrect logic or unhandled edge cases. After inspection, I saw that they did have calls in Form Control buttons (Save and Close) and (Close) to clear the work table. This led me to believe that when users where "X"ing out of the application without clicking either of those two buttons, the work table files were not being cleared. Now I have looked into End Dialog as an answer to delete the work files from there, but I couldn't find much documentation or discussion that wasn't 15 years+ old. Some of what I read said that it is inconsistent in if it works depending on the action. Finally, to the question, how does End Dialog work or how is it trigger. Can it be relied upon to call logic to clear a work table when a user exits out of an application without saving or clicking any FC buttons?
Last edited:
The users could be X ing out of E1 altogether, or it's an acculimation of many system crashes? OR It's bad code and the key is not right.

End Dialog


Last Modified: B733​

DialogisInitialized is the reverse of the DialogisInitialized event and is always run just before a form is closed.

Available On

  • All form types.

Available Objects

  • All objects are available.

Typical Usage

Use this event to free memory allocated during entry in the form.

Additional Notes

This event is run before business view columns are copied to their corresponding form interconnections, so changes should therefore be made to the business view columns where there is automatic copying to propagate correctly.

Processing Sequence

  1. This event runs.
  2. Business view columns are copied to form interconnects.
  3. The form closes.
If it's not necessary to retain any of the data in the work table from prior sessions, or if the application can't ever have concurrent sessions, you could just clear the table upon initialization. If concurrent usage of the work table by different users is needed, just delete the rows tagged to the user starting up the new instance. Use an existing or create a new USER audit column in the table.
Hi @dtujo2022

If this work table is used for displayed in a grid only, and is not used for any event after, you could to delete temporary rows in "Last grid record has been read". Maybe, these rows are stored when user closed the browser.

Finally, to the question, how does End Dialog work or how is it trigger. Can it be relied upon to call logic to clear a work table when a user exits out of an application without saving or clicking any FC buttons?
IMO your instinct to put cleanup code in the End Dialog event correct. That is where I put all of my cleanup code by default if possible. But stuff kind of has to be architected with that in mind so you may or may not be able to "easily" move existing code to this event. Theoretically code in the Save / Cancel button should also be executing. I prefer the End Dialog event because it is cleaner, more self documenting and less prone to bugs being introduced if changes are made later on.

In theory the End Dialog event should fire in these cases.

1. User explicitly Closes the Form (Save or Cancel) the way all developers want them too. Or other code effectively closes the window by pressing Save or Cancel.
2. If browser close detection is working it should also effectively fire this event if the user just closes the browser.
3. JAS session timeout. Provided all the various timeout settings (JDE and App Server) are all set 100% correctly - which is a daunting and counter intuitive task for your CNC guys.

Having said that, things can still go wrong for whatever reason and and work tables and other cleanup things still don't execute.
One thing I've noticed is that Business Functions don't seem to be called in the EndDialog event. I have NER business functions that clear work tables that I tried adding to the EndDialog event but they weren't executed, so I had to replace them with explicit ER delete statements to clear the tables.
Thank you for the clarification, clearing the work table in end dialogue should meet my needs, of course I will be sure to test.