10-20-2010 07:19 PM
I've wrote a plugin to change Contact content field globally like a replace function for all the selected record.
I have my DialogBox in Modeless mode and the Contact Details View open..
Everything work well except that the value is not updated on the contact record.
here a snippet:
contact .Updated += new MutableEntity.UpdatedEventHandler(contact_Updated);
The UpdatedEvent is well generated and contact_Updated called.
the field contact.State move from Unchanged to Modified ...
BUT in the DetailView when use application.UIContactManager.ShowContact(contact) the field is not updated and display the old value.
Is anything I missed ?
10-21-2010 06:10 AM
Thx for the reply,
No, I try using both way SDK and previous/next button.
BTW: I check the Fields attributes and I have the right to change the value and obviously is not readOnly .
I have also try by Locking the Database and the result is the same ... so I continue to search
The behaviour look like a Transaction before a Commit statement
I ran on Windows XP Pro + SQL Server 2005 and ACT! by Sage Premium 2010 Version 12.0.409.0 on the same system
Any idea ?
10-21-2010 06:46 AM
Tested this for a bit and I think it might be related to the issues with updating the first contact.
If I login and try to run this against the first contact the fields are not updated:
Contact c = _ActApp.ApplicationState.CurrentContact;
ContactFieldDescriptor userField2 = _ActApp.ActFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.USER2");
Same goes for:
c.Fields["TBL_CONTACT.USER3", Act.Framework.MutableEntities.FieldNameType.Real] = "Changed";
However if I move to the next contact before running the plug-in, all the values are updated for either method for changing field values.
06-08-2011 06:33 AM
That is probably the issue that Jacques is having. I had completely forgotten about this one but it has been an issue with a program I've been working on lately. Thanks for reminding me about it. I think the issue is that the current contact doesn't get updated properly for the first contact but I'm not absolutely positive about that.
06-08-2011 06:54 AM
Reading this thread I remembered a refresh data on the contact list. Would that be helpful?
' Refresh the List
' Overloaded - refresh one record
Maybe calling the refresh updates the binding manager which in turn would cause the bound controls to refresh.
On another note, Matthew, is there a way to access the binding manager directly so we can refresh it.
-- Jim Durkin
06-08-2011 07:50 AM
@Jacques: The issue has been resolved in version 14, I know this isn’t particularly helpful. However, as Jim has mentioned you should be able to work around the issue by refreshing. I could submit a request for inclusion in a hotfix for version 13, but with beta starting up and most of the content already approved for the next hotfix it may be difficult to get this done.
@Stan: Unfortunately, I’m not entirely sure what the root cause of the problem was.
@Jim: The binding manager isn’t exposed, I’m unsure at this point whether this will continue to be the case in version 14 or not.
07-25-2011 08:48 PM
Finally I found a "workaround" and I post it as it can be useful for everybody before the bug correction.
The goal of my tool was to replace a string in contact's field by an another string : e.g. "str" replace by "Street" for all contacts
using the following code
ContactList cl= ActFwk.Contacts.GetContacts(null); // All contact in the DB
foreach (Contact c in cl)
object o = currentField.GetValue(c);
if (o != null)
string s = o.ToString();
string r = s.Replace(currentSearchText, currentReplaceText);
The contact.State was set to "Modified" and the Updated event was fire.
But I didn't get an Update in Views nor in Database
After many try/error tests , I found the following "Workaround" by using Lookups
Just add the those lines before the foreach loop
ContactList cl= ActFwk.Contacts.GetContacts(null);
IContactSource src=ActFwk.Lookups.LookupContactsNarrow(cl, currentSearchText,Act.Framework.Lookups.OperatorEnum.Contains, currentField);
ContactList cl = src.GetContacts(null);
This seems to work well both for Contacts and for Companies
The contact.State stay to "Unchanged" but Views and database are updated ...
Hope this helps
07-26-2011 06:14 PM
so basically (would never really happen0 but if the ACT! db has only ONE contact then your stuffed
This problem/BUG has been around for many version that you have to refresh or more up/down one contact for things to start working.. i feel its pointless have to REFRESH the contact even thou it was just loaded when the application opened
Seriously Sage, it was been reported many times and that long ago, you still havnt sorted this problem out yet after how many versions?
If you cant even work it out, why havnt you just added the one line of code we have to add to refresh the current contact when the application starts, so we dont have to??