Community
Showing results for 
Search instead for 
Do you mean 
Reply

Trapping update event from vb.net

New Member
Posts: 2
Country: Canada

Trapping update event from vb.net

Hi,

 

I'm trying to develop a plugin that will update the contact in a third party software. I can't find which event I need to trap for that !

 

In the AfterLogon event of my plugin, i'm trying this code :

 

 

AddHandler MyActApp.ApplicationState.CurrentContact.Updated, AddressOf ContactUpdated

 

but the sub "ContactUpdated" never fired...

 

Please help !

 

Thanks in advance

 

Yves

 

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Trapping update event from vb.net

Hiya,

 

Try placing the handler within the ViewLoaded event it should work then.

 

HTH,

Vivek

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Nickel Super Contributor
Posts: 441
Country: UK

Re: Trapping update event from vb.net

Hi Yves, 

I always use the current contact changing and current contact changed events.

When the current contact is changed you need to add the contact updated event to the current contact.

When the current contact is changing you need to remove the contact updated event from the current contact.

 

Hope that makes some sense Smiley Happy

 

Tom

 

Tuned Listener
Posts: 35
Country: Australia

Re: Trapping update event from vb.net

Your comments are a good start.

Some code would be even better.

 

Reece harper

Act! Certified Consultant Australia
http://www.databasepartners.com.au
Nickel Super Contributor
Posts: 441
Country: UK

Re: Trapping update event from vb.net

Just for you Smiley Happy ...

 

 Private Sub ActApp_AfterLogon(ByVal Sender As Object, ByVal e As System.EventArgs)
        'trap the contact changing and changed events
        AddHandler ActApp.CurrentContactChanging, AddressOf CurrentContactChanging
        AddHandler ActApp.CurrentContactChanged, AddressOf CurrentContactChanged
    End Sub 'ActApp_AfterLogon

    Private Sub CurrentContactChanging()
        'contact is changing so remove the contact updated event for this contact
        RemoveHandler ActApp.ApplicationState.CurrentContact.Updated, AddressOf ContactUpdated
    End Sub

    Private Sub CurrentContactChanged()
        'the contact has changed so trap the contact updated event
        AddHandler ActApp.ApplicationState.CurrentContact.Updated, AddressOf ContactUpdated
    End Sub

    Private Sub ContactUpdated()
        'do stuff for your contact updated event here
    End Sub
Tuned Listener
Posts: 35
Country: Australia

Re: Trapping update event from vb.net

Thanks for the code.

 

1. This works on Create and Update but contact.State is always "Unchanged".

2. It does not work on Delete.

3. Do you need to put the remove of the event handler in a try block in case the event handler is not there?   

Reece harper

Act! Certified Consultant Australia
http://www.databasepartners.com.au
Nickel Super Contributor
Posts: 441
Country: UK

Re: Trapping update event from vb.net

1. I have never used the contact.State property sorry.

2. This event only fires when a contact is saved, I'm not sure how you'd trap a contact deleted event.

3. You could do but it does fall over gracefully without it.

New Member
Posts: 7
Country: United States

Re: Trapping update event from vb.net

If it makes you feel any better, I came up with the same solution as outlined here, and came up with the same results as you.  It appears that by the time the event is triggered the changes have been applied and the contact.state field is always set to false.  I struggled for quite some time (unsuccessfully) to catch the current state of the contact object while changes are made.  I wonder if someone from ACT! could verify this.
jmb
New Member
Posts: 2
Country: United States

Re: Trapping update event from vb.net

Does anyone have an example of trapping a contact being deleted? As mentioned, contact.State seems useless for detecting this event.

 

Since this post is over a year old I'm hopeful someone out there has worked this one out by now.

 

TIA

jmb
New Member
Posts: 2
Country: United States

Re: Trapping update event from vb.net

Hello,

 

I'm looking for some help with an issue I'm having while developing a plug-in for ACT! 2009. I need to trap the three basic contact events from ACT!: contact created, changed or deleted. Using CurrentContact.Updated I'm able to detect when a contact is created and updated but not when it is deleted. I've tried using .EntityState to determine the state of the contact but it never changes. Is there some special method or technique I'm missing? Any help would be greatly appreciated.

Thank you,

jmb