02-21-2012 06:55 PM
Hi,
I have a Contact object, after some modification on the object properties, I want the object to be reloaded to its initial state which is the same as the values stored in the database. How could I discard the changes to the properties and reload the object?
Thanks a lot!
03-02-2012 02:51 AM
You can try this to remove your contact object from cache :
Sage.Platform.EntityFactory.Evict(object.GetType(), object.Id);
and then reload it with:
Sage.Platform.EntityFactory.GetById(object.GetType(), object.Id);
Hope this helps...
05-07-2012 10:11 PM
It doesn't work.
I tried above, but after reload, the modify date is still not changed. However, when I query the database outside SalesLogix, I can see the valud there already updated.
05-23-2012 01:36 PM
Try the typed version instead. Note that this assumes that the variable 'a' contains an Account:
Sage.Platform.EntityFactory.Evict<Sage.Entity.Interfaces.IAccount>(a.Id);
After doing this, I typically re-direct back to whatever page I was on in order to pick up the new data.
05-23-2012 01:47 PM
This redirect code works in a code snippet:
using System.Web;
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.ToString());