Showing results for 
Search instead for 
Do you mean 

Mass Update Accounts - Days Since Last Touched

by ajappel on ‎09-01-2011 07:28 AM

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.Interfaces.IAccount> act = Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IAccount>();

    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();

        }

    }

Register Read Guidelines Request Partner or Employee Access

What's New in 8.1

Labels