Over the course of my time working with Sage ACT! and it's SDK customer base, one of the most frequently asked questions I get is "what event(s) should I register for?"
Others questions are of a similar vein, such as "What order can I expect these events to fire?"; or "What does this event do exactly?" Therefore I decided to clear up as much
of this confusion as I could and make it much easier for SDK users to actually see what events are firing and integrate this into the built in Sage ACT! logging API that many SDK consumers are familiar with.
First let's take a look at how to enable logging for events in the Sage ACT! 2012 release:
#1. Locate "Actsage.exe.config" which is in your install directory (Default: "C:\program files\act\act for windows")
#2. Open thefile using notepad.exe or some other text editor (not MS word though)
#3. Go toward the bottom of the file to the section for logging for <system.diagnostics> (See Below)
<!--Logging Levels: value =
0 – Off
1 – Error
2 – Warning
3 – Info
4 – Verbose
<!-- New High Level Log Categories - beginning with ACT! 12.1 -->
<add name="ACTCommonSwitch" value="1"/>
<add name="ACTFrameworkSwitch" value="1"/>
<add name="ACTApplicationSwitch" value="1"/>
<add name="ACTEventSwitch" value="1"/>
<!-- The categories below are not used in new code, but still exist in legacy code
(i.e., you may need to set the logging levels for both the old (below)
#4. Change the line for ACTEventSwitch from "1" to "4"
Now you will have the exposed SDK events (or as many as I felt relevent by release) show up in the ACTLOG.xml file - most people just run "Logviewer.exe" from their install directory AFTER the exit ACT! to get results.
Let's take a look at a sample that I just made - this one demonstrates starting ACT! and going to the default view :
9:46:18.703 UI Event: Startup at Act.UI.ActApplication.OnStartup()
9:46:26.156 UI Event: Open at Act.UI.ActApplication.OnOpen()
9:46:26.172 UI Event: CancelLogoff at Act.UI.ActApplication.OnCancelLogoff()
9:46:26.750 UI Event: BeforeLogon at Act.UI.ActApplication.OnBeforeLogon()
9:46:28.389 UI Event: OnCurrentContactListChanging at Act.UI.ActApplication.OnCurrentContactListChanging()
9:46:28.436 UI Event: CurrentContactListChangeda t Act.UI.ActApplication.OnCurrentContactListChanged()
9:46:28.764 UI Event: AfterLogon at Act.UI.ActApplication.OnAfterLogon()
9:46:29.795 UI Event: ViewLoaded at Act.UI.ActApplication.OnViewLoaded()
9:46:29.811 UI Event: CurrentViewChanged at Act.UI.ActApplication.OnCurrentViewChanged()
9:46:29.889 UI Event: CurrentViewLoaded at Act.UI.ActApplication.OnCurrentViewLoaded()
9:46:50.570 UI Event: OnCurrentContactChanging at Act.UI.ActApplication.OnCurrentContactChanging()
9:46:50.570 UI Event: CurrentContactChanged at Act.UI.ActApplication.OnCurrentContactChanged()
Note: Obviously this is currently pretty raw, but I plan on going back and trying to add more detailed information into the log message, but the descriptions for these are shown in Visual Studios' autocomplete feature.
For those of you who are familiar with writing plugins, many of these events (delegates actually), should be quite familiar.The event most people are familiar with is the "OnViewLoaded".
Why this event so important?It's the first event after the user is logged in AFTER 1st view has been loaded.It's the ideal place to add a menu item, custom tab, etc.
I hope this gives you a primer on the way you can use the logging system in order to better understand what events are important to you and what order they are triggered.