Showing results for 
Search instead for 
Do you mean 

Contact.Update() failing in ACT!2006

New Member
Posts: 9
Country: United States

Contact.Update() failing in ACT!2006

[ Edited ]

Hi All,


I've been trying all sorts of things to work around this and I can't seem to get it quite right. 


I have a very simple plugin that adds a menu item to the Tools menu. I enter the Contact view, then click on my new menu item. In my menu handler, I set a field value, then call myContact.Update(). I do this multiple times in a row. The first time succeeds. The second time the Update() fails. I can see this programmatically because myContact.State is still Modified after the call to Update(). The third time I execute the menu item, the state of myContact is Modified when I enter the handler. And the field value never changes. So I've somehow put the current contact into a Modified state and there is no way to apply the updates. 


For a trivial one-field set I seem to be able to get away without calling Update(). But in my large, real application this does not work properly. So I need to call Update(), but it isn't working correctly.


Can anyone shed some light on this? Here is my trivial example:


public void menu_update_contact_handler(string x)
// get the field descriptor for the contact field we want to update
string field = "CUST_ContactsTable11_030554.CUST__eb_test_033019046";
Act.Framework.Contacts.ContactFieldDescriptor fd =
_app.ActFramework.Contacts.GetContactFieldDescriptor(field, true);

// get the current contact
Act.Framework.Contacts.Contact cContact = _app.ApplicationState.CurrentContact;
Debug.Assert(cContact.State == Act.Framework.EntityState.Unchanged, "pre-set");

// set the current timestamp into the field
fd.SetValue( cContact, DateTime.Now.ToString());
Debug.Assert(cContact.State == Act.Framework.EntityState.Modified, "post-set");

// update the contact
Debug.Assert(cContact.State == Act.Framework.EntityState.Unchanged, "post-update");


The results of this are:

Run 1: no assertions fire

Run 2: fires post-update

Run 3+: fires pre-set and post-update 


Thanks for any thoughts!



ps. In my real handler, I clear a ton of fields then call Update and Referesh to show that the fields have been cleared. I then recalculate the fields and call Update and Referesh again to show the new values in the fields. The assertions fire in pretty much the same manner. Both Updates in the first call work as expected. But on the second and subsequent executions of the menu handler the contact state becomes Modified and no calls to Update are able to change the state to Unchanged.





Message Edited by cod3monk3y on 11-07-2008 08:20 AM
Nickel Super Contributor
Posts: 441
Country: UK

Re: Contact.Update() failing in ACT!2006

The following works fine for me, I just used address 1 as I didn't have a spare character field but everytime you click the menu item it updates the field fine and you can see the time increasing.


 Dim contact As Act.Framework.Contacts.Contact = ActApp.ApplicationState.CurrentContactcontact.Fields("Contact.Address 1", False) = Now.ToString





New Member
Posts: 9
Country: United States

Re: Contact.Update() failing in ACT!2006

[ Edited ]

Thanks for the quick reply, Tom.


Unfortunately this did not work for me. I created a new test database just in case there was something rotten with my production database. This did not help either. Here is my exact code, a C# version of yours:


[edit] I get the same exact behavior that I saw with my previous code. The "Address 1" field updates on the first run and not any previous runs.


Act.UI.ActApplication _app;

public void OnLoad(Act.UI.ActApplication actApp)
_app = actApp;
_evhLogon = new EventHandler(actApp_AfterLogon);
... other handlers ...

private void actApp_AfterLogon(object sender, EventArgs e)
... add menu item ...

public void menu_handler(string x)
Act.Framework.Contacts.Contact contact = _app.ApplicationState.CurrentContact;
contact.Fields["Contact.Address 1", false] = DateTime.Now.ToString();


Any other thoughts?



My versions are:

ACT! by Sage Premium for Workgroups 2006 Version

XP Professional Version 2002 Service Pack 2

Lenovo Intel(R) Core(TM)2 CPU T5600 @ 1.83 GHz / 1.83 GHz, 3.00 GB of RAM

Database Settings (only some of the obvious relevant settings):

Language: en-US

Schema Version: 08.02.0080.0000

Schema Date: Wednesday, April 05, 2006 5:01 PM

Original Schema Version: 08.02.0080.0000

Database Product: Microsoft - SQL SERVER 2000 - Desktop Engine

Database Product Version: 8.00.818 - SP3

SQL Database Properties: SIMPLE Recovery, Auto-Create Statistics, Auto-Update Statistics, Auto-Shrink, Torn-Page Detection

Database Collation: Latin1_General_CI_AS

Sync Enabled: False








Message Edited by cod3monk3y on 11-07-2008 01:45 PM
New Member
Posts: 9
Country: United States

Re: Contact.Update() failing in ACT!2006

[ Edited ]



I pruned my Plugin directory down to just 4 of my plugin files and two that I couldn't delete, so I'm left with:

SimplePlugin2.dll (and .pdb)

My.Common.dll (and .pdb - dependant dll for SimplePlugin2)

Act.UI.InternetExplorer.Plugins.AttchFile.dll (which I couldn't delete)


 ..and the update is working correctly! I'll post again when I figure out what file in there was causing the problem


[edit] There are a TON of files in this directory. Is this normal? When I originally took over this code, I believe I copied someone's entire plugin directory. So I'm not sure what should and should not be here. Here's the list, which seems egregious to me:


Directory of C:\Program Files\ACT\ACT for Windows\Plugins 04/05/2006 04:33 PM 28,672 AccountingLinkConversion.dll 04/05/2006 04:32 PM 20,480 Act.Devices.UI.Plugin.dll 04/05/2006 03:39 PM 524,288 Act.Framework.ComponentModel.dll 04/05/2006 03:39 PM 53,248 Act.Framework.Interop.dll 04/05/2006 03:39 PM 20,480 Act.Framework.Messaging.dll 08/15/2005 02:27 PM 126,976 Act.Interop.SHDocVw.dll 06/04/2008 07:34 AM 65,536 Act.Shared.ComponentModel.dll 04/05/2006 03:39 PM 176,128 Act.Shared.Diagnostics.DefectLogger.dll 04/05/2006 03:39 PM 348,160 Act.Shared.FDO.dll 04/05/2006 03:39 PM 28,672 Act.Shared.Messaging.dll 04/05/2006 03:39 PM 16,384 Act.Shared.UI.Utilities.dll 04/05/2006 03:39 PM 65,536 Act.Shared.Windows.Forms.NotificationItem.dll 04/05/2006 03:50 PM 159,744 Act.UI.Activities.Views.Shared.dll 04/05/2006 03:50 PM 81,920 Act.UI.ActivityViews.Widgets.TimeSelector.dll 04/05/2006 03:49 PM 2,473,984 ACT.UI.Common.Images.dll 04/05/2006 03:50 PM 741,376 Act.UI.Core.dll 04/05/2006 03:50 PM 225,280 Act.UI.CriteriaDlg.dll 04/05/2006 03:50 PM 655,360 Act.UI.DataExchange.dll 04/05/2006 03:50 PM 307,200 Act.UI.Designer.Controls.dll 04/11/2006 11:06 AM 319,488 Act.UI.Designer.Conversion.dll 04/05/2006 03:54 PM 524,288 Act.UI.Designer.Layout.dll 04/05/2006 03:50 PM 81,920 Act.UI.Designer.Report.Data.dll 04/05/2006 03:50 PM 1,642,496 Act.UI.Designer.Report.dll 04/05/2006 03:50 PM 16,384 Act.UI.Designer.Report.Resources.dll 04/05/2006 03:51 PM 16,539,648 Act.UI.dll 04/05/2006 03:50 PM 32,768 Act.UI.Email.dll 04/05/2006 03:50 PM 225,280 Act.UI.GroupCompanyPicker.dll 04/05/2006 04:39 PM 24,576 Act.UI.InternetExplorer.Plugins.AttachFile.dll 04/05/2006 04:54 PM 286,720 Act.UI.InternetServices.Plugins.dll 04/05/2006 03:49 PM 20,480 Act.UI.LookupsResources.dll 04/05/2006 03:50 PM 487,424 Act.UI.PickList.dll 04/05/2006 03:50 PM 1,327,104 Act.UI.SyncSetup.dll 04/05/2006 03:50 PM 81,920 Act.UI.Updater.dll 06/11/2006 02:23 PM 2,576 Act.UI.Updater.xml 04/05/2006 03:49 PM 425,984 Act.UI.Widgets.dll 03/05/2004 12:00 PM 8,192 ActEmailConnectorMetaData.dll 04/05/2006 03:12 PM 2,150,400 AdalWrapper.dll 11/07/2008 02:10 PM 61,440 MY.Common.dll 11/07/2008 02:10 PM 136,704 MY.Common.pdb 11/07/2008 02:10 PM 430,080 MYPlugIn.dll 11/07/2008 12:05 AM 2,351 MYPlugIn.dll.config 11/07/2008 02:10 PM 792,064 MYPlugIn.pdb 02/06/2003 03:30 PM 7,574 attachfile.ico 02/20/2007 02:48 AM 49,152 AxInterop.SHDocVw.dll 11/06/2008 10:51 PM 20,480 SimplePlugin.dll 11/06/2008 10:51 PM 15,872 SimplePlugin.pdb 11/07/2008 02:17 PM 20,480 SimplePlugin2.dll 11/07/2008 02:17 PM 17,920 SimplePlugin2.pdb And a separate folder with more files that I've moved out of the Plugins folder, since I'm in the middle of debugging at the moment... 08/15/2005 02:27 PM 126,976 Act.Interop.SHDocVw.dll 04/05/2006 04:39 PM 24,576 Act.UI.InternetExplorer.Plugins.AttachFile.dll 04/22/2005 12:51 PM 1,298,432 C1.C1PrintDocument.dll 09/25/2004 11:55 AM 86,016 C1.Common.dll 04/22/2005 12:51 PM 634,880 C1.Win.C1PrintPreview.dll 07/06/2005 12:02 PM 671,744 C1.Win.C1Report.dll 07/06/2005 12:02 PM 188,416 C1.Win.C1ReportDesigner.dll 09/02/2004 06:55 AM 1,290,240 DevComponents.DotNetBar.dll 08/20/2004 08:27 AM 370,473 DevComponents.DotNetBar.xml 05/27/2003 12:00 PM 208,896 DevExpress.Utils.dll 05/27/2003 12:00 PM 139,264 DevExpress.XtraNavBar.dll 09/14/2005 08:10 PM 946,176 Excel.dll 08/28/2002 10:11 AM 192,512 Genghis.dll 04/05/2006 03:39 PM 126,976 Infragistics.Act.Shared.dll 04/05/2006 03:39 PM 90,112 Infragistics.Act.Win.UltraWinListBar.dll 04/21/2005 11:31 AM 24,576 Infralution.Common.dll 04/21/2005 11:31 AM 98,304 Infralution.Controls.dll 04/21/2005 11:31 AM 364,544 Infralution.Controls.VirtualTree.dll 06/17/2004 04:53 PM 122,880 Interop.CDO.dll 09/14/2005 08:10 PM 61,440 Interop.DartMail.dll 05/25/2004 10:28 PM 9,216 Interop.LinkDataWrapperLib.dll 07/14/2003 09:46 PM 397,312 Interop.Outlook.dll 02/20/2007 02:48 AM 131,072 Interop.SHDocVw.dll 09/22/2005 08:05 PM 53,248 Interop.Shell32.dll 07/03/2003 01:31 PM 57,344 Interop.VBIDE.dll 07/14/2003 09:51 PM 655,360 Interop.Word.dll 07/10/2003 03:07 PM 45,056 Janus.Windows.Common.dll 07/10/2003 03:07 PM 245,760 Janus.Windows.ExplorerBar.dll 05/21/2004 01:48 PM 180,224 LinkDataWrapper.dll 07/21/2006 01:09 PM 40,960 LivingObjects.dll 11/08/2002 11:34 AM 57,344 Microsoft.Vbe.Interop.dll 04/22/2005 02:02 PM 0 MSHTML.dll 03/16/2007 02:05 PM 73,728 nunit.framework.dll 03/16/2007 02:05 PM 279,779 nunit.framework.xml 09/14/2005 08:10 PM 155,648 Office.dll 01/07/2005 08:40 AM 167,936 TAPIEx_Wrap.dll 08/02/2005 10:00 AM 258,048 TXTextControl.dll 09/14/2005 08:10 PM 495,616 Word.dll



Message Edited by cod3monk3y on 11-07-2008 02:36 PM
New Member
Posts: 9
Country: United States

Re: Contact.Update() failing in ACT!2006

[ Edited ]

Ok, I've tracked it down. The update fails only when I've viewed a contact from Contact List view.


For example, when I start up ACT it starts in Contact Detail view. If I run the update it works fine every time. But if I then switch to Contact List view and then double click a contact to go back to Contact Detail view, the update only works the first time. If I switch to Groups View and switch to Contact Detail by clicking on a contact in the group membership panel, the update works fine every time. But if I then switch to Contact List view and then double click that same contact to get back to Contact Detail view, the update will only work the first time.


Here are my specific steps to recreate and verify the problem. I did this on a brand new database with only 2 contacts and a Plugin directory that contains only my 2 DLLs:

SWITCH TO TEST database (simpleupdate_test.pad)
- open db, should open in Contact Detail view
- Run menu command. 1st is OK, 2nd+ are also OK
- Switch to Contact List view
- Double click on the Contact you just viewed
- Run menu command. 1st is OK, 2nd+ are NOT OK

Update through GROUPS
- Create a group
- Add some contacts to the group
- Click on a contact from the group, which brings up Contact Detail view
- Run menu command, 1st is OK, 2nd+ are also OK

Update through Lookup created from Group View
- Switch to Group view (View > Groups)
- Right Click the new group and choose Create Lookup which takes you to Contact List view
- Double click the contact to get to Contact Detail view
- Run menu command. 1st is OK, 2nd+ are NOT OK

Creating a Group from a Lookup
- run and advanced lookup (Lookup > Advanced > Advanced Query: Contact/Company/Contains Data)
- run and save the lookup as "any_company"
- set the Group Name
- click on the All Groups window
- click on the any_company group
- click on the contact
- Run menu command. 1st, 2nd+ are all OK
- Switch back to Group Detail view
- Right click the "any_company" group and select Group Membership > Add/Remove Contacts


You should see that the membes are Dynamic. Use this technique instead of using Lookups and you should never see the bad behavior.


Can anyone confirm this behavior? Or suggest a work-around?


I'm wondering what will happen if I get the contact ID from the CurrentContact field of the ActApp, then do a contact lookup in code to get the ActContact. I'm thinking somehow the CurrentContact is bogus when viewing the Contact Details from a Contact List view... it's just a theory for now...



Message Edited by cod3monk3y on 11-08-2008 09:13 AM
New Member
Posts: 9
Country: United States

Re: Contact.Update() failing in ACT!2006

[ Edited ]

Ok, I've found a work-around. I use the ApplicationState to get the unique GUID and then bypass the ApplicationState by then requesting the contact directly from the framework using GetContactsByID().


For now my problem is solved, but I'd love to have someone else confirm that this is an actual bug in ACT, and maybe check out and see if it still exists in the newest versions. 







/// <summary>
/// When viewing the Contact Details from a lookup or from any double-clicking on the Contact List
/// view, the current contact will fail to update if udpated multiple times consecutively.
/// This method takes bypasses the ApplicationState and gets a new version of the current contact
/// directly from the ActFramework
/// Topic:
/// Related Items:
/// ///
/// </summary>
/// <returns></returns>
Act.Framework.Contacts.Contact SafeGetCurrentContact()
// try the simplest of work-arounds using contact.ID GUID
Act.Framework.Contacts.Contact contact = _app.ApplicationState.CurrentContact;

if(contact == null) { return null; }
ContactList cList = _actFwk.Contacts.GetContactsByID(
new System.Guid[] { contact.ID },
null );
if(cList != null && cList.Count == 1)
return cList[0];
return null;





Message Edited by cod3monk3y on 11-09-2008 01:14 PM
Bronze Elite Contributor
Posts: 2,119
Country: United_Kingdom

Re: Contact.Update() failing in ACT!2006



Hmmm...have you tried just checking the EntityState of the contact before you call .Update() ?

Could you just insert a MessageBox.Show(contact.State.ToString()); before you call the Update() method. Hopefully this will show a value of "Modified" first of all and allows an Update() call. If the State = "Unchanged" thenwe have our problem!


Let us know what the results are.



Vivek Gargav
Caldere Associates Ltd.
My Blog
New Member
Posts: 9
Country: United States

Re: Contact.Update() failing in ACT!2006

Hi vivek,


Yes, that's actually how I tracked down the problem in the first place! I don't have the trace logs here right now, but I'm positive it looked like this:


1st run:


set field value



unchanged --- update clears the state as expected


2nd (3rd, 4th, etc.) run:


set field value



modified --- update does not set it back to UNCHANGED



Again, this only happens when I've entered Contact Details via a Lookup followed by a double click on a lead from Contact List view.


I've put my workaround into production and the problem has gone away. I feel strongly that the EntityState propery has a bug.