August 08, 2012

Limiting user sessions(Set Timeout For User Session)

Limiting user sessions

Our company has a limited number of AX user licenses, as most companies will. Some people like to open multiple sessions (and eat up licenses) while they're working. We wanted some way for the system to prevent this from happening.
To achieve this I created a table called UserSessionLimits. It has a field called UserID (extended data type is userId) and this is a mandatory field. It has another field called MaxSessions (this is an integer) and it also is mandatory. The index is UserIDx, it contains userid and it is unique.
The code that accesses this table is written so that if a user is not in this table, then they are limited to one session, so add users to this table if they are exceptions and you want them to be able to have more than one session open.
Add code to the "Info" class, in the startup() method. The Info class can only be accessed by going to the System Documentation area of the AOT.
In the startup method, at the top, I placed this code:

select count(recid) from sysClientSessions
where sysClientSessions.userId == curuserid() &&
sysClientSessions.Status == 1 &&
sysClientSessions.clientType == 0;
if(sysClientSessions.RecId > UserSessionLimits::getMaxSessions(curUserid()))
{
box::stop(strfmt("You have exceeded your session limit of %1, the application will now close",
UserSessionLimits::GetMaxSessions(curUserid())));
appl.globalcache().set(classstr(info),identifierStr(AutoLogoff), true);
this.shutDown(true);
}

By searching only for clientType = 0, you will only be looking for "User" sessions. Web sessions or worker sessions (batches that are running) will not be affected.
There have been times that people have gotten around this. They quickly opened two sessions immediately one after the other. If they are simultaneously opened, it's hard to catch. Also, sometimes this locks people out. If they were doing something and AX shut down on them or their system froze, sometimes it takes some time for the session to end for them to get back in again. Your network administrator can control when inactive sessions time out.

We also set automatic shutdown (in user options) to 60 minutes. So if their session is inactive for 60 minutes, it will close.

See also,


Update multiple records with 'Fill Utility'

Update multiple records with 'Fill Utility'

Note:- FOLLOW THIS STEPS ON YOUR OWN RISK,I WILL NOT BE RESPONSIBLE FOR ANY GOOF UPS. SO PLZ BE CAREFULL DURING THESE STEPS.
The Fill utility enables authorized users and/or administrators to mass-update records, similar to the find and replace functionality. We can use an alternative method also to Update Multiple records in Grid.
this utility assists administrators or users during implementations/Development or when business process changes affect multiple records.
Cautions:
1> It is recommended practice to take backup of entire database before performing this 'Fill Utility' operation.
2> It is recommended to use this feature during implementations/Development (or) when business process changes affect multiple records.
3> Please follow the standard procedure to enable this configuration. This may require restart of AOS & Data dictionary sync to make sure changes take immediate effect.
4> Be aware that changing numerous records at the same time can be time-consuming.
Enable configuration key:
Path: Dynamics Ax > Administration > Setup > System > Configuration > Under Administration tree (Enable 'Fill Utility' option)
Fill Utility usage:
Open the form that contains the field to update.
Example:  Dynamics Ax > Accounts Receivable > Common forms > Customer details > Select required customer record > payment tab

Right click on the field 'Ledger account' field > Record info

Click button 'Fill Utility'

We can select the criteria here
Click button 'OK'

Validate the records and click 'OK'

Select new 'Terms of payment' = N045 (here we have to specify new terms of payment)
Click 'OK'
Caution: Be aware that changing numerous records at the same time can be time-consuming.
Fill Utility log:
Path: Dynamics Ax > Basic > Inquiries > Fill Utility log

Security key: Adminfillutility
This completes 'Fill Utility' feature details from usage.
This a very useful to update multiple records at the same time.
- Harry