Community
Showing results for 
Search instead for 
Do you mean 
Reply

Which is the best Event for calling ContactFields.FieldChanged

Copper Contributor
Posts: 13
Country: India

Which is the best Event for calling ContactFields.FieldChanged

Hi all,

 

I want to track the changes in one particular field on Contact screen.

( 

g_ObjActApp.ApplicationState.CurrentContact.ContactFields.FieldChanged += new Act.Framework.MutableEntities.MutableEntity.FieldCollection.FieldChangedHandler(Fields_FieldChanged2);

)

 

Currently I am using CurrentContactChanged and ViewLoaded for calling the above event.

 

void ActApp_AfterLogon(object sender, EventArgs e)

{

try

 

g_ObjActFwk = g_ObjActApp.ActFramework;

g_ObjActApp.ViewLoaded +=
new ViewEventHandler(g_ObjActApp_ViewLoaded);

g_ObjActApp.ViewUnloaded += new ViewEventHandler(g_ObjActApp_ViewUnloaded);g_ObjActApp.CurrentContactChanged +=

new EventHandler(g_ObjActApp_CurrentContactChanged);

 

 

 

 void g_ObjActApp_ViewLoaded(object sender, ViewEventArgs e)

 

   

g_ObjActApp.ApplicationState.CurrentContact.ContactFields.FieldChanged += new Act.Framework.MutableEntities.MutableEntity.FieldCollection.FieldChangedHandler(Fields_FieldChanged1);

 

 

void g_ObjActApp_CurrentContactChanged(object sender, EventArgs e)

         

g_ObjActApp.ApplicationState.CurrentContact.ContactFields.FieldChanged += new Act.Framework.MutableEntities.MutableEntity.FieldCollection.FieldChangedHandler(Fields_FieldChanged2);

 

 

I do not want to use CurrentContact event. I want to call the "FieldChanged" when user presses tab.

 

Is there any pther event that I can use?

 

Nickel Super Contributor
Posts: 441
Country: UK

Re: Which is the best Event for calling ContactFields.FieldChanged

You don't need to use the view loaded event, see below.  VB but you get the idea.  Tom

 

'add a handler to trap the contact changing and changed events

Addhandler ActApp.CurrentContactChanging, AddressOf ContactChanging

Addhandler ActApp.CurrentContactChanged, AddressOf ContactChanged

 

'on the contact changing event remove the handler

Private Sub ContacChanging

Try

RemoveHandler ActApp.ApplicationState.CurrentContact.Fields.FieldChanged, AddressOf FieldChanged

Catch ex as exception

end try

end sub

 

'on contact changed add the field changed handler

Private Sub ContactChanged

AddHandler ActApp.ApplicationState.CurrentContact.Fields.FieldChanged, AddressOf FieldChanged

End Sub

 

'field changed hander, runs when foucs leaves a field

Private Sub FieldChanged(fieldName as string)

'do your field changed work here

End Sub

 

Tom