Skip to Content

Application Event in Detail

During the years I recently noticed that there have been some changes on what acually happens during a Application Shutdown and I’ve decided to do a little research on the subject. Since I’ve been working with the SDK for 3 years now it had been a long time since I tested it, and since I found a few unexpected results I’ve decided to share them with you (people new to SDK might allready know all this).

Before SAP Business One 2004A add-ons were launched is a very primitive way compared to the SBO2004A and future releases.
The add-ons were not registrated in the company but using the regedit. This system was not very good for multiple databases since you were the one that needed to tell your addon if it should run on the current database. In SBO2004A it all changed and is the system we know now, but in the SDK the Application Event have not changed its syntax and that might be why some of the event in here actually never is fired.

The 4 possible event and thier description in the SDK Help Center:</p><ol><li>BoAppEventTypes.aet_CompanyChanged = Occurs when the Company database changes.</li><li>BoAppEventTypes.aet_LanguageChanged = Occurs when the interface language changes. </li><li>BoAppEventTypes.aet_ServerTerminition = <not documented anymore></li><li>BoAppEventTypes.aet_ShutDown = Occurs when the SAP Business One application shuts down</li></ol><p>While Add-on is running Application event receives the following events:
User action: If Add-on is manually stopped from Administration > Addons > Add-On Manager
Event fired: BoAppEventTypes.aet_ShutDown Event
Comments   : As expected

User action: Change company
Event fired: BoAppEventTypes.aet_ShutDown Event
Comments   : It has always been my belive that here i BoAppEventTypes.aet_CompanyChanged should happen, but since I always did the same thing for both company changed and shutdown I’ve never expected this.

User action: Change language
Event fired: BoAppEventTypes.aet_LanguageChanged Event
Comments   : As expected

User action: Close SAP Business One Client
Event fired: BoAppEventTypes.aet_ShutDown Event
Comments   : As expected

User action: When addon is closed by SAP during an Add-on Upgrade
Event fired: BoAppEventTypes.aet_ShutDown Event
Comments   : As expected

User action: Close the UI API (taskbar icon right click > Exit)
Event fired: No events
Comments   : I’ve would actually have guessed that all got a termination event or a shutdown event, but that is not the case.

My conslusion so far:
– There does not really seem to be any reason to call CompanyChanged or ServerTermination since they are not fired (I still do just in case I’ve missed something)

My open questions:<br />– Why is BoAppEventTypes.aet_ServerTerminition is not documented in in SDK Help Center anymore (Is it not used because of the changes in SBO2004 on how addons is launched, but if that is the case, why is it not mentioned as deprecated)?
– Why is BoAppEventTypes.aet_CompanyChanged still documented in in SDK Help Center as being launched when it is not (it should be marked as deprecated)?


1 Comment
You must be Logged on to comment or reply to a post.
  • according to my past SDK support memory, this application event will be fired when add-on is disconnected (on purpose or accidentally). programmer shall catch this and write some destructive codes to quite their add-on instance. i might be wrong, cuz it’s been quite a while…somebody called their add-on instance remained in memory even Business One was shut down