10-07-2008 11:15 AM
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
10-08-2008 12:57 AM
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
10-08-2008 12:57 AM
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
10-08-2008 01:43 AM
Hi Tom,
I knew I was missing something...
Cheers for that! As ever you are a scolar and a gentleman!
Vivek
10-08-2008 02:01 AM