Using Event Server |
Events are sent through an intermediate service SOEventServer.
Programs must register with the service to receive event notifications.
Events are sent through an event publisher, not through the standard visual basic event mechanism. You need to:
Set objMyListener = new MySaleEventHandler Set objEventserver = New SOEVENTSERVERLib.Publisher m\_SubscriptionId = objEventserver.AddSubscription("SuperOfficeEvents.SaleEvents", objMyListener) Set objEventserver = Nothing
Whenever an event happens, the event server calls a method on the registered object (objMyListener in this case) through IDispatch (late binding)
So when you click on a sale in the activity list, the following method is called:
objMyListener.CurrentSaleIdentityChanged
In order to function, the SO Event Server must be registered before it can be started.
Starting SOCRM.EXE will start the event server if the event service has been registered on the machine.
SOEVENTSERVER.EXE /REGSERVER
On Win2000 and up you can run SOEVENTSERVER as a service so that it is always available:
SOEVENTSERVER.EXE /REGSERVICE NET START SOEVENTSERVER
You can change the startup to automatic in the Services control panel.
This appears to cause trouble for some, so it is best to use /REGSERVER and to rely on SOCRM to start it for you.
These steps can be automated using SOLOADER.INI
This application will display a list of events it receives.
We'll listen for Contact, Sale and Application events.
Private m_ContactEventsId As Long Private m_SaleEventsId As Long Private m_AppEventsId As Long Private Sub Form_Load() Dim objEventserver As SOEVENTSERVERLib.Publisher Set objEventserver = New SOEVENTSERVERLib.Publisher m_ContactEventsId = objEventserver.AddSubscription("SuperOfficeEvents.ContactEvents", Me) m_SaleEventsId = objEventserver.AddSubscription("SuperOfficeEvents.SaleEvents", Me) m_AppEventsId = objEventserver.AddSubscription("SuperOfficeEvents.ApplicationEvents", Me) Set objEventserver = Nothing End Sub ' IContactEvents members Public Sub CurrentContactIdentityChanged() Trace "Current Contact.IdentityChanged" End Sub Public Sub CurrentContactSaved() Trace "Current Contact.Saved" End Sub Public Sub CurrentContactCanceled() Trace "Current Contact.Canceled" End Sub Public Sub CurrentContactFieldChanged(ByVal field_id As Long) Trace "Current Contact.FieldChanged " & field_id End Sub
You can track a lot of Events
You have to react to the appropiate action
If your application is based on events, then make sure:
Lots of things can go wrong.