
When you click a button it will update the “Days Since Last Touched” field (custom field account.SeDaysSinceLastTouch , String 32 ) for EVERY account in SalesLogix where the Subtype = Key Accounts. Then use the standard group building functionality to create a new group that shows Key Accounts not touched in X days.
Button – Onclick Action – C# Snippet Action Item (Obsolete)
// When button clicked it will calculate the number of days since a Key Account has been touched
Sage.Platform.RepositoryHelper<Sage.Entity.Interfa
Sage.Platform.Repository.ICriteria crit = act.CreateCriteria();
crit.Add(act.EF.Eq("SubType", "Key Account"));
foreach (Sage.Entity.Interfaces.IAccount keyAccts in crit.List<Sage.Entity.Interfaces.IAccount>())
{
if (keyAccts.LastHistoryDate != null)
{
DateTime dt1 = Convert.ToDateTime(System.DateTime.UtcNow);
DateTime dt2 = Convert.ToDateTime(keyAccts.LastHistoryDate);
TimeSpan ts = dt1 - dt2;
int days = ts.Days;
keyAccts.SeDaysSinceLastTouch = Convert.ToString(ts.Days);
keyAccts.Save();
}
else
{
keyAccts.SeDaysSinceLastTouch = "70+";
keyAccts.Save();
}
}
You must be a registered user to add a comment here. If you've already registered, please log in. If you haven't registered yet, please register and log in.