Community
Showing results for 
Search instead for 
Do you mean 
Reply

Contact Update issue

New Member
Posts: 12
Country: France

Contact Update issue

Hi Guys,

 

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:

 

currentField.SetValue(contact, NewValue);
 contact .Updated += new MutableEntity.UpdatedEventHandler(contact_Updated);
 contact.Update();

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 ?

 

Thx

Copper Super Contributor
Posts: 112
Country: Australia

Re: Contact Update issue

i think you have to refresh the current contact view to see the new changes.. im guessing that if you move back and forth one contact that the new value is then visible??

New Member
Posts: 12
Country: France

Re: Contact Update issue

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 ?

 

Employee
Posts: 1,163
Country: USA

Re: Contact Update issue

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");             
           
userField2.SetValue(c, "Test");
            
c.Update();

 

Same goes for:

 

c.Fields["TBL_CONTACT.USER3", Act.Framework.MutableEntities.FieldNameType.Real] = "Changed";
            c.Update();

 

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.

 

 

 

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 12
Country: France

Re: Contact Update issue

Hello guys,

 

I still have the same issue on this problem even with the v13 . 
Is somebody can help me on this .

 

many thx in advance

Jacques

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Contact Update issue

Matthew,

 

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.

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Contact Update issue

Reading this thread I remembered a refresh data on the contact list. Would that be helpful?

 

' Refresh the List

ACTApplication.ApplicationState.CurrentContactList.RefreshData()

 

' Overloaded - refresh one record

ACTApplication.ApplicationState.CurrentContactList.RefreshData(ACTApplication.ApplicationState.CurrentContactList.IndexOf(ACTApplication.ApplicationState.CurrentContact))

 

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.

BindingSource.ResetCurrentItem()

 

-- Jim Durkin

Employee
Posts: 1,163
Country: USA

Re: Contact Update issue

@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.

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 12
Country: France

Re: Contact Update issue

Hi Team,

 

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);                   

currentField.SetValue(c, r);                   

c.Update();

}

}

cl.RefreshData();

-----------------------------------------------------------------------------------------------

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);

foreach .....

 

This seems to work well both for Contacts and for Companies

 

Remarks :

The contact.State stay  to "Unchanged" but Views and database are updated ...

 

Hope this helps

Jack

 

Copper Super Contributor
Posts: 112
Country: Australia

Re: Contact Update issue

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??