January 02, 2013

How to Restrict Multiple Time login of a same user

Hi Folks,

Many times intentionally or unintentionally a user may open multiple session of AX. That surly impact your performance. So here is a fix,
1.     Go to AOT
2.     Open class ‘Info’
3.     Copy Paste the Following Code in startupPost method.

void startupPost ()
{
// To restrict user login form second login
xSession session;
SysClientSessions SysClientSessions;
UserId currentUserId;
int counter;
;
currentUserId = curUserId();
if(currentUserId!="Admin")// only Admin User is allowed to login multiple time
{
while select SysClientSessions
where SysClientSessions.userId == currentUserId &&
SysClientSessions.Status == 1 // 1 : Login 0 : Logout
{
session = new xSession(SysClientSessions.SessionId, true);
if (session && session.userId())
{
counter++;
}
}
if(counter>=2)
{
Box::stop("Already Logged-in : The same user id can't log in twice.");
infolog.shutDown(true);
}
}
}

Please take backup of your application before copying code

-Harry

December 29, 2012

Import Opening Stock Balance into Dynamics AX

Import Opening Stock Balance into Dynamics AX

When we import opening stock balance into inventory journal using the standard import/export functionality, the most common problem is dealing with Inventory Dimension id (InventDimId). We might know the warehouse and batch, but we do not know what is the InventDimId that represents the combination of these two inventory dimension.
One way to do this is to lookup the InventDimId value manually before performing the import. This is only possible if very few inventory dimensions are used.


An alternative is using the Custom import functionality to import stock balance CSV file into Tag counting journal.
There is a conversion functionality in the Custom import, where you can write a little X++ code to find the InventDimId using the inventory dimensions.
Here is an example of finding the InventDimId using Site and Warehouse dimension.




You must select Run conversion checkbox to activate the conversion. You may also use the compile icon (on the right hand) to validate the X++ code.
The purpose to use Tag counting journal instead of Movement/Counting journal is we let the system to create the Lot ID when we post the Tag counting journal into Counting journal.


- Harry