Community
Showing results for 
Search instead for 
Do you mean 
Reply

.SetValue does not refresh layout fields anymore

New Member
Posts: 2
Country: United States

.SetValue does not refresh layout fields anymore

MutableEntityFieldDescriptor.SetValue does not refresh the layout field ( new value successfully written to the database though ... but the texbox on the layout still shows the old value )

 

It used to work in v 12.0, but is broken in SP1  (12.1.181.0)

Employee
Posts: 1,163
Country: USA

Re: .SetValue does not refresh layout fields anymore

I'll look into this to see if this change was expected.

 

From looking at the method overview I wouldn't have expect it to cause the layout to refresh, but I understand that if it had been doing it previously that was the expectation. 

Matthew Wood
Act! SDK Support
Community Moderator
Copper Elite Contributor
Posts: 95
Country: USA

Re: .SetValue does not refresh layout fields anymore

actApplication.RefreshView(actApplication.CurrentView.ToString());

 

where actApplication is of the type Act.UI.ActApplication

 

call this code after you set the value, send beer.

 

-Nick

Nick Bohne
Effective Solutions, Inc.
Copper Contributor
Posts: 61
Country: United_Kingdom

Re: .SetValue does not refresh layout fields anymore

Sorry for bring an old post to life, but it is relevent to my query.

 

Long story short I'm putting a value in a field after the user presses 'New...'. It seems that you have to save (press Save) before the value will display.

 

Here's my code:

 

private void Database_ContactChanged(object sender, EventArgs e)
        {
            Contact cContact = application.ApplicationState.CurrentContact;
            if (cContact.IsNew == true)
            {
                try
                {
                    ContactFieldDescriptor fd = application.ActFramework.Contacts.GetContactFieldDescriptor("AliasHere", Act.Framework.MutableEntities.FieldNameType.Alias);
                    fd.SetValue(cContact, "TheValue");

                    application.RefreshView(application.CurrentView.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }

Ideally, I want to see the value onscreen before pressing save. I thought the refresh would achieve this but it doesn't (not the way I'm using it anyway)

 

Thanks in advance,

 

 

SS

Employee
Posts: 1,163
Country: USA

Re: .SetValue does not refresh layout fields anymore

I think all you need to do is Update the contact once you've set the field value.

Matthew Wood
Act! SDK Support
Community Moderator