Community
Showing results for 
Search instead for 
Do you mean 
Reply

Contact.Updated / Contact.ContactField.FieldChanged Events only firing once

New Member
Posts: 3
Country: USA

Contact.Updated / Contact.ContactField.FieldChanged Events only firing once

I am currently working on a plugin to sync information between act! and another database. So far I have been able to trap the Contact.Updated and Contact.ContactField.FieldChanged events. My syncing functions are also working great, however once my event fires once, it won't fire again on that contact until I change to a new contact, change back, and execute the triggering action again.

 

At this point I feel like I'm just shooting in the dark. Any help would be hugely appreciated. below is a list of steps I perform to replicate my issue and some code samples. 

 

 

act! Version: Premium 16.1.207.0

Targeted .NET Framework: 4

 

 

1) Open ACT! anc click the "Contacts" tab.

2) Click ListView and select a contact (as the first contact never fires...known issue?)

3) Change ID/Status Field value

3) Click "Save" Button

4) Contact.Updated Event Fires Successfully

5) Click "List View" Button

6) Select Same Contact as before

7) Change ID/Status Field value

8) Click "Save" Button

9) Contact.Updated Event Never Fires

 

public class Class1 : IPlugin
    {
        ActApplication actApplication;

        public void OnLoad(ActApplication actApp)
        {
            this.actApplication = actApp;

            actApplication.CurrentContactChanged += newEventHandler(On_ContactChanged);
        }

        public void OnUnLoad()
        {

        }

        private void On_ContactChanged(object sender, EventArgs e)
        {
            
            Contact contact = actApplication.ApplicationState.CurrentContact;

            contact.ContactFields.FieldChanged += new 
MutableEntity.FieldCollection.FieldChangedHandler(On_ContactFieldChanged);

            contact.Updated += new MutableEntity.UpdatedEventHandler(On_ContactUpdated);            
        }

        private void On_ContactUpdated()
        {
            Contact contact = actApplication.ApplicationState.CurrentContact;

            MessageBox.Show(contact.FullName);

        }

        private void On_ContactFieldChanged(string fieldName)
        {
            Contact contact = actApplication.ApplicationState.CurrentContact;

            if(fieldName == "TBL_CONTACT.CUST_FIELDNAME_105535493")
            {
                                
                ValidatePrimaryContact(contact);
                
                
            }
                
        }
    }
}

 

 

Copper Super Contributor
Posts: 52
Country: United_Kingdom

Re: Contact.Updated / Contact.ContactField.FieldChanged Events only firing once

[ Edited ]

Hi jwburgess06,

 

Thank you for you forum post.

 

I've tested this with my own plugin and see the same behavior. 

 

public static ActApplication oApp;
        public void OnLoad(ActApplication actApp)
        {
            oApp.CurrentContactChanged += oApp_CurrentContactChanged;
        }

        private void oApp_CurrentContactChanged(object sender, EventArgs e)
        {
            MessageBox.Show("oApp_CurrentContactChanged fired");

            Contact c = oApp.ApplicationState.CurrentContact;

            c.ContactFields.FieldChanged += c_FieldChanged;
            c.Updated += c_Updated;
        }
        private void c_FieldChanged(string fieldName)
        {
            MessageBox.Show("c_FieldChanged fired");
        }
        private void c_Updated()
        {
            MessageBox.Show("c_Updated fired");
        }

 I tested in the latest release of Act! referencing the latest assemblies. 

 

I'll query this with our developers and post again once I have something useful.

 

Kind regards,

 

 

Russell

 

#103722

Copper Contributor
Posts: 123
Country: Canada

Re: Contact.Updated / Contact.ContactField.FieldChanged Events only firing once

This is how Act has always seemed to work.  I haven't tried this but maybe once the event fires you could change the contact to a different contact and then switch back to the previous contact and see if the event will fire again.

Probably not the idea solution.

New Member
Posts: 3
Country: USA

Re: Contact.Updated / Contact.ContactField.FieldChanged Events only firing once

I look forward to seeing what the developers come up with. I'm hoping it's a simple bug/patch situation. Thanks for the follow-up.

New Member
Posts: 3
Country: USA

Re: Contact.Updated / Contact.ContactField.FieldChanged Events only firing once

@e_hoog, that is in fact how it works. if I change contacts, the event will fire again, but it sounds like a bug behavior to me. the event should fire every time the contact is updated. It almost sounds like the contact isn't updating until it has already passed out of scope of "current contact". Any updates from the engineers yet?

Copper Super Contributor
Posts: 52
Country: United_Kingdom

Re: Contact.Updated / Contact.ContactField.FieldChanged Events only firing once

[ Edited ]

Hi jwburgess06,

The issue is still in the process of being investigated. I will confirm if this is a defect as soon as I know.

Kind regards,


Russell

#103722 - SDK - c.ContactFields.FieldChanged and c.Updated only fire once 

 

- 18th August 2014 12:22 - With developers for investigation.