Showing posts with label 2009. Show all posts
Showing posts with label 2009. Show all posts

10 Apr 2015

Restrict user login + AX 2012

Following Code in startupPost method of info class in AOT


void startupPost()
{
// To restrict user login form second login
xSession session;
SysClientSessions SysClientSessions;
UserId currentUserId;
int counter;

;

currentUserId = curUserId();

if(currentUserId!="Admin")// Allow Admin User 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);
}
}
}

13 Aug 2013

Fix for adding a new dimension in Dynamics AX

A very minor fix is required on the following SysDimensionAddWizard class to enhance the dimension functionality in Dynamics AX 4.0 and Dynamics AX 2009. This fix is not required for Dynamics AX 2012.

SysDimensionAddWizard class which runs the Financial Dimension Wizard, it is used for adding a new financial dimension to the system. Number of adding dimensions are controlled by Dynamics AX License key. Make sure you have sufficient licenses for the number of dimensions you are adding to Dynamics AX 2009, Since user defined dimensions are limited to seven.

Standard AX comes with the following three default dimensions:

Department
Cost center
Purpose

In SysDimensionAddWizard class changes are required in its run() and versionControlCheckOut() methods.

Add the code to run() method under the if statement as shown in the below image.


Add the code to the versionControlCheckOut() method as shown in the below image.



After adding the above code, test by adding the dimensions.

Note: There's no limitation on creating user defined dimensions, if you are using Dynamics AX 2012 ,the above fix and code changes are not required.

30 Apr 2013

Easy Extended AX Table-Browser + AX 2009

Developers open the tables from AOT in the Table-Browser and by hand attempt to add/delete the records by hitting Ctrl+N/Alt+F9 keys and often copies the records from the table-browser and paste them to excel for checking/saving/printing/... the table data to avoided by simply extending the Table-Browser by adding the Standard data Toolbar to the form

Step-1: Go to the AOT and select \Forms\SysTableBrowser\Designs\Design
and then change the design property WindowType value from “Popup” to “Standard”



Changing WindowType property value to “Standard”

Step-2: Save and compile the SysTableBrowser Form after changing the WindowType property value



The original Table-Browser (WindowType property is “Popup”)



Easy Extened Table-Browser with Standard-Toolbar (WindowType property is “Standard”)

That’s it, enjoy the easy extended table-browser with the standard toolbar with all table/record action features

8 Apr 2013

Splitters in AXAPTA

Splitters in Dynamics AX [X++, SysFormSplitter_Y, SysFormSplitter_YBottomBound]

There are 3 types of splitters : X -axis, Y-axis and Y-axis BottomBound
Classes which help for adding splitters are listed below.

1.SysFormSplitter_X

2.SysFormSplitter_Y

3.SysFormSplitter_YBottomBound

Splitter is actually a group control but by setting up some properties on the group control will make it look like a thin line as a seperator.
Let us learn all these splitters one by one with an example.. Follow me to learn splitters..

Y_Axis splitter:

Create a new form with name SR_YAxisSplitter and add 3 new controls to it.
Add a stringEdit control “Name” and set the autodeclaration property as “Yes”
Add a group control “GroupSplitter” and set the proeprties as shown in the image below.





Add another string edit control “Organization” .
Now, your form should like the screen shot below



Modify the classdeclaration method of the form by creating an object of SysFormSplitter_Y as shown below

public class FormRun extends ObjectRun
{
SysFormSplitter_Y _formSplitter;
}

Override the init() method of the form and instantiate the SysFormSplitter_Y class as shown below.

void init()
{
super();
_formSplitter = new SysFormSplitter_Y(groupSplitter,Name,element);
}

Override 3 methods mouseup(), mousedown() and mousemove() methods as shown below



______________________________________________________________________
int mouseUp(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
ret = super(x, y, button, ctrl, shift);
Return _formSplitter.mouseUp(x, y, button, ctrl, shift);
}
_______________________________________________________________________
int mouseMove(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
ret = super(x, y, button, ctrl, shift);
Return _formSplitter.mouseMove(x,y,button,ctrl,shift);
}
_______________________________________________________________________
int mouseDown(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
ret = super(x, y, button, ctrl, shift);
Return _formSplitter.mouseDown(x, y, button, ctrl, shift);
}
_______________________________________________________________________
There you go.. We are done with the development. Now let’s see how your form look like with your newly created splitter. Below is the screen shot.


____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

X_Axis splitter:

Let us learn now how to create X -Axis splitters on the form
Create a new form by name SR_XAxisSplitter as shown below.
Add first group control and set the following properties as shown below
Height : ColumnHeight
Widht : ColumnWidth
Columns: 3
FrameType : None
Below is the screen shot for your reference : Columns property – set to 3



Inside the group add 3 controls
1) StringEdit control “Name” [Autodeclaration property - Yes]
2)GroupSpliiter Control
3)ListView control with properties [Height - ColumnHeight and width as ColumnWidth]
Set the following properties on the GroupSplitter control





Next, paste the following code in the classdeclaration method

public class FormRun extends ObjectRun
{
SysFormSplitter_X _formSplitter;
}
Override the init() method and add the below code

void init()
{
super();
_formSplitter = new SysFormSplitter_X(groupSplitter,Name);
}
Override mouseup, mousemove and mousedown method on the groupsplitter control and add the below code

______________________________________________________________________
int mouseUp(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
ret = super(x, y, button, ctrl, shift);
Return _formSplitter.mouseUp(x, y, button, ctrl, shift);
}
______________________________________________________________________
int mouseMove(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
ret = super(x, y, button, ctrl, shift);
Return _formSplitter.mouseMove(x,y,button,ctrl,shift);
}
______________________________________________________________________
int mouseDown(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
ret = super(x, y, button, ctrl, shift);
Return _formSplitter.mouseDown(x, y, button, ctrl, shift);
}
______________________________________________________________________
That’s it..we are done with X-Axis splitter as well. Now let’s see how the form looks like. Below is the screen shot



____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Y_Axis BottomBound:

Y-Axis button bound will be used in ListPages forms as a splitter between the grids and any other controls
Below the screenshot – of newly created ListPage. Follow the properties and addition of controls as shown below.


Next, paste the below code in class declaration method

public class FormRun extends ObjectRun
{
SysFormSplitter_YBottomBound splitter;
}
Override the init() method and paste the following code

public void init()
{
#define.startupHeight(175);
super();
splitter = new SysFormSplitter_YBottomBound(grid, ctrlSplitVertical, previewPane, this, #startupHeight);
}
Override the mouseup, mousemove, mousedown methods on the groupsplitter control and paste the below code

int mouseUp(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
;
super(x, y, button, ctrl, shift);
ret = splitter.mouseUp(x, y, button, ctrl, shift);
return ret;
}
______________________________________________________________________
int mouseMove(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
;
super(x, y, button, ctrl, shift);
ret = splitter.mouseMove(x, y, button, ctrl, shift);
return ret;
}
_____________________________________________________________________
int mouseDown(int x, int y, int button, boolean ctrl, boolean shift)
{
int ret;
;
super(x, y, button, ctrl, shift);
ret = splitter.mouseDown(x, y, button, ctrl, shift);
return ret;
}
______________________________________________________________________
That’s it pals..we are done with the splitter on the list pages. Below is how your listpage look now.



2 Apr 2013

SysQueryRangeUtil class -Use method name as query criteria(Reports)

This is a cool new feature in AX 2009 - you can now use a method name instead of literal value in query criteria!

For example, if you run a report every month, previously you need to change the date criteria in each month you running the report
(ie.“01/06/2010..30/06/2010”, “01/07/2010..31/07/2010”, etc).
Now you only need to enter (monthRange(0, 0)) which will automatic return the correct first day and last day of the month.

For Example:-



You can also refer to the SysQueryRangeUtil class – there are a lot of useful methods such as dateRange(), currentEmployeeId(), etc. It’s also possible to create new method on this class for special purpose. But do this with caution.

Display the current user Name

1) The following code is used to display the current user Name .

display Name userName()
{
return XUserInfo::find(false, curuserid()).Name;
}

Cheque Printing in Ax2009

Cheque Printing in Ax2009 is very simple.Already there are classes and reports available in Ax2009.
Just the matter is change the develop the new report(with the help of existing Cheque reports) and code in classes.
First:
Create a new base enum in ChequeFormType(ex:HDFC)
Scond:
List of classes for Cheque:
1.BankPrintTestCheque(for testing the layout of the cheque)
2.BankChequePrint(is the main class for 'Bank Cheque printing')
3.CustVendCheque(calles when vendor payment and customer payemnt->generate payment)
add the code whereever ChequeFormType enum is used :)-
Third:
dublicate the existing report 'Cheque_DK' and rename.
change the design as per the HDFC Bank layout.

Test ur cheque layout process:-
1. select a perticular bank a/c in bank details form under Bank Module.
2. Click setup button->cheque layout.
3. select cheque number as fixed.Select check form as 'HDFC' then click Print test button.
Note: before testing the print layout for hdfc bank need to develop a new report.

The same report is called when u print the report from the vendor payment journal :)-

22 Mar 2013

Security Keys in Ax

Dynamics Ax provides following keys to provide the security for application

1.License Keys : 
First Level Security , specifies what all featues/modules/developemnt tools we can access in the standard product.License Keys will be used after installation to unlock the product.License Keys will be issued by the microsoft for partners/vendors to develop vertical/generic solutions.

2.Configuration Keys :
Second Level Security , To Enable/Disable the object/feature for all the users.

3.Security Keys :
If you want to enable/disable object/features to group of users.

4. Record Level security :
Basically it deals with the data , if you want to restrict the viewing of records per user group than we setup record level security.

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...