Adding User’s Login Date and Time Data in SalesLogix v7.5.1 Web

Question: In SalesLogix v7.5.1 Web is the date and time of a user’s login recorded anywhere?

Answer: This information is not being written within the SalesLogix v7.5.1 Web
client, but you can easily add code to accomplish this.  On the
Base.Master, add the following lines on the Page_Load function:

if (Session[“logdatewritten”] == null)
{
string userID = ApplicationContext.Current.

Services.Get(true).UserId.Trim();
string SQL = string.Format(“UPDATE SLXWEBUSERINFO SET LASTLOGINDATE = GETUTCDATE() WHERE USERID = ‘{0}'”, userID);

System.Data.OleDb.OleDbConnection openConnection = GetOpenConnection();
System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(SQL, openConnection);
command.ExecuteNonQuery();

Session.Add(“logdatewritten”, “yes”);
}

Then, add the following function to the file:

private static System.Data.OleDb.OleDbConnection GetOpenConnection()
{ //There are other ways to obtain a connection, but this works.
string ConnectionString = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>().GetConnectionString();

System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection(ConnectionString);
connection.Open();
return connection;
}

Make
sure the userid exists in the table before running the update
statement.  If the userid doesn’t exists use an Insert statement.

 

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!