Community
Showing results for 
Search instead for 
Do you mean 
Reply

Contact onSave Event?

Copper Contributor
Posts: 16
Country: United_Kingdom

Contact onSave Event?

I am trying to add a handler to the contact onSave event but there doesn't seem to be an easy way of getting the event. Through posts on this forum I have the following code but it doesn't seem to trigger:

 

 

        public void The_ViewChanged(object sender, EventArgs e)
        {
            //Event Handeler, Triggers when the Act view is changed.

            MessageBox.Show("View Changed " + application.CurrentViewName.ToString());
            if (application.CurrentViewName == "Act.UI.IContactDetailView")
            {
                //Currently In the Contact Detail View
                Act.Framework.Contacts.Contact c = application.ApplicationState.CurrentContact;
                c.Updated += new MutableEntity.UpdatedEventHandler(c_Updated);
            }
            
        }

        void c_Updated()
        {
            MessageBox.Show("Test");
        }

 

Does anyone know how to action this? (Act Premium 2011).

 

 

 

Employee
Posts: 1,163
Country: USA

Re: Contact onSave Event?

At a glance the code looks fine, try moving to another contact and see if it fires then. There is an issue currently under investigation regarding events not firing for the first contact to load after launching the application.

Matthew Wood
Act! SDK Support
Community Moderator
Copper Contributor
Posts: 16
Country: United_Kingdom

Re: Contact onSave Event?

No unfortunately that doesn't work either, I also tried creating a new contact record to see if it fires but nothing.

 

Using Act Premium 2011 13.1.111.0.

 

Any more ideas?

 

Thanks.

Employee
Posts: 1,163
Country: USA

Re: Contact onSave Event?

[ Edited ]

This should work:

 

 

void AfterLogon(object sender, EventArgs e)
        {

            try
            {
                ActApp.ActFramework.Activities.ActivityCleared += new ActivityManager.ClearActivityDelegate(Activities_ActivityCleared);
                ActApp.ViewLoaded += new ViewEventHandler(ActApp_ViewLoaded);
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }

        void ActApp_ViewLoaded(object sender, ViewEventArgs e)
        {
            ActApp.CurrentContactChanged += new EventHandler(ActApp_CurrentContactChanged);
            ActApp.CurrentContactChanging += new EventHandler(ActApp_CurrentContactChanging);
        }

        void ActApp_CurrentContactChanging(object sender, EventArgs e)
        {
            ActApp.ApplicationState.CurrentContact.Updated -= new MutableEntity.UpdatedEventHandler(CurrentContact_Updated);
        }

        void ActApp_CurrentContactChanged(object sender, EventArgs e)
        {
            ActApp.ApplicationState.CurrentContact.Updated += new MutableEntity.UpdatedEventHandler(CurrentContact_Updated);
        }

        void CurrentContact_Updated()
        {
            MessageBox.Show("Updated");
        }

 

 

Matthew Wood
Act! SDK Support
Community Moderator