The SalesLogix web client offers users the ability to see “recently viewed” items. These show the various records the user has navigated to during their current web session.
This recently viewed history is accessible programmatically. Lets take a look at how to use it.
The first thing to realize is that access to the history is contained in the Sage.Platform.Application.IEntityHistoryService class. Instantiating an instance of this using the Sage.Platform.Application.ApplicationContext.Current.Services.Get<>() method allows you to then work with the collection.
Lets take a look at a situation where I want to do something with the most recent contact the user navigated to. I could create server side code like this:
Sage.Platform.Application.IEntityHistoryService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Application.IEntityHistoryService>(false);
Sage.Entity.Interfaces.IContact byId = null;
foreach (Sage.Platform.Application.EntityHistory history in service)
string name = history.EntityType.Name;
if (name != null)
if (name == "IContact")
byId = Sage.Platform.EntityFactory.GetById<Sage.Entity.Interfaces.IContact>(history.EntityId.ToString());
if (byId !=null)
//do something here
There you go. Not too bad at all.