Community
Showing results for 
Search instead for 
Do you mean 
Reply

Contact Created Event

Accepted Solution Solved
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom
Accepted Solution

Contact Created Event

Hi Guys,

 

Hope someone can help since I think I am loosing the plot a little here! For the life of me I can not find a ContactCreated() event? Am I missing something or is there no such event? This is causing me a real pickle since I need to capture when a User creates a new contact and calls Update().

 

I see the Updated() event but if I understand correctly that would be called even if the user just updated a field, so for this particular problem it is not appropriate as it could be called for an existing contact and not for a new contact.

 

I hope I am being stupid or blind!

 

TIA

Vivek

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog

Accepted Solutions
Solution
Accepted by topic author vivek
‎09-25-2015 03:20 AM
Nickel Super Contributor
Posts: 441
Country: UK

Re: Contact Created Event

Hi Vivek,

I had this problem a while back.  There is an IsNew property on the contact.  You can handle the contact changed event and
check this property.  It remains True until the contact is saved for the first time.  Little code snippit below...

 Private Sub ActApp_AfterLogon(ByVal Sender As Object, ByVal e As System.EventArgs)
        AddHandler ActApp.CurrentContactChanged, AddressOf ContactChanged
 End Sub

  Private Sub ContactChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim cContact As Contact = ActApp.ApplicationState.CurrentContact
        MsgBox(cContact.IsNew)

        'you could add something here to say if new then addhandler contact updated or something
  End Sub

HTH Smiley Happy

View solution in original post


All Replies
Solution
Accepted by topic author vivek
‎09-25-2015 03:20 AM
Nickel Super Contributor
Posts: 441
Country: UK

Re: Contact Created Event

Hi Vivek,

I had this problem a while back.  There is an IsNew property on the contact.  You can handle the contact changed event and
check this property.  It remains True until the contact is saved for the first time.  Little code snippit below...

 Private Sub ActApp_AfterLogon(ByVal Sender As Object, ByVal e As System.EventArgs)
        AddHandler ActApp.CurrentContactChanged, AddressOf ContactChanged
 End Sub

  Private Sub ContactChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim cContact As Contact = ActApp.ApplicationState.CurrentContact
        MsgBox(cContact.IsNew)

        'you could add something here to say if new then addhandler contact updated or something
  End Sub

HTH Smiley Happy

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Contact Created Event

Hi Tom,

I knew I was missing something...

Cheers for that! As ever you are a scolar and a gentleman! Smiley Happy

 

 

Vivek

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

Re: Contact Created Event

No worries Vivek, happy to help Smiley Happy