Community
Showing results for 
Search instead for 
Do you mean 
Reply

Code Check - CurrentContactChanged

Copper Super Contributor
Posts: 478
Country: Australia

Code Check - CurrentContactChanged

Hi all

 

Was wondering if any one can see a problem with this code of mine?

 

The point was when you changed contacts and if the contact was lasted edited over 90 days ago it would call another piece of code that would count the history items

 

The history code works fine as i also call it from a button in the contact record but the CurrentContactChanged does not, it stalls Act and i have use task manager to close it down

 

Any guidance would be appreciated

 

        void oApp_CurrentContactChanged(object sender, EventArgs e)
        {
            try
            {
                Contact c = oApp.ApplicationState.CurrentContact;

                String EditValueS = c.Fields["TBL_CONTACT.EDITDATE", true].ToString();
                DateTime modifiedtime1 = Convert.ToDateTime(EditValueS).AddDays(90);
                DateTime modifiedtime2 = Convert.ToDateTime(EditValueS).AddDays(7);

                DateTime checktime = DateTime.Today;

                if (modifiedtime1.Date <= checktime.Date)
                {
                    countHistories(null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, oApp.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6
Copper Super Contributor
Posts: 478
Country: Australia

Re: Code Check - CurrentContactChanged

For those interested it appears to work now that i removed the refresh comand

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6