09-16-2013 08:06 AM - edited 09-18-2013 05:32 AM
We are currently having a few issues programmatically updating the current record that a user has opened up. We are taking the following basic sequence of actions
We are finding that Sage does not always save the updated data correctly. We find when going into a record for the first time the values are not saved. What we sometimes see is that all the data flashes onto the record and then disappears, as if the values are written, and then ovewritten again with blank values. We are using the basic code listed at the end of this post. Can anyone point me in the right direction?
Thanks,
Darren
----
Act.Framework.Opportunities.Opportunity opportunity = this.App.ApplicationState.CurrentOpportunity;
Act.UI.OpportunityView.OpportunityDetailView view = this.App.ActiveControl as Act.UI.OpportunityView.OpportunityDetailView;
view.Save(); //Persist any active changes.
//Retrieve a value
Act.Framework.MutableEntities.MutableEntityFieldDescriptor getField =
this.App.ActFramework.Opportunities.GetMutableEntityFieldDescriptor("MyGetColumnName", true);
object value = getField.GetValue(opportunity);
//Lookup based on this value
object newValue;
Act.Framework.MutableEntities.MutableEntityFieldDescriptor setField =
this.App.ActFramework.Opportunities.GetMutableEntityFieldDescriptor("MySetColumnName", true);
setField.SetValue(opportunity, newValueConverted);
//OR
opportunity.OpportunityFields[setField.Name, true] = newValue;
//Tried various things to persist including
opportunity.update();
view.save();
this.App.ApplicationState.CurrentOpportunities.RefreshData();