Translate

Showing posts with label AX 2012. Show all posts
Showing posts with label AX 2012. Show all posts

Thursday, July 24, 2014

Code to check the current user have system administartor rights in AX X++ code

Hi,


Sometime before I was written a big statement to find out the System admin rights of current user. Later I realized about global function that will help us to find the same.


isSystemAdministrator(): will tell you the current user is having the admin rights or not.


if isSystemAdministrator() return true then the user is having system admin rights, else not a system admin.


Hope this helps you.
Prasn

Wednesday, June 19, 2013

AX 2012 – SSRS Reporting : Selecting the report design at the runtime based on the static parameter (dialog field) values

 
Hi,

Here is a solution to select the design at the runtime based on dialog field values in AX 2012 SSRS reports. Hope this will help you.

 
Create a controller class that extends SrsReportRunController()
 
And override preRunModifyContract() in the controller() class and follow the below steps.
 
protected void preRunModifyContract()
{
    boolean     paramValue1;
    boolean     paramValue2;
 
    SrsReportDataContract dataContract = this.parmReportContract();
    SrsReportRdlDataContract contract = dataContract.parmRdlContract();
 
    paramValue1 = contract.getValue(Param1_name);
    paramValue2 = contract.getValue(Param2_name);
   
    if(paramValue1)
    {
        dataContract.parmReportName(reportname.design_1);
    }
    else if(paramValue2)
    {
        dataContract.parmReportName(reportname.design_2);
    }
   // else default design is used to display the report which is used in main(); or you can specify your design name here
}
 
static void main(Args _args)
{
    xxx controller = new xxx (); // Let us assume the current class as xxx
 
    controller.parmReportName(reportName.defaultDesign);  // Make sure you specify the default design while running the report and this is required to run the report and to get the dialog.
    controller.parmArgs(_args);
    controller.startOperation();
}
 
And now, Create the output menu item and specify the object type to class and specify the object to this controller class which we create now. And the report is ready to select the design at runtime.
Hope this will helps you,
Prasan.. J
 

Tuesday, July 10, 2012

Creating single field as Primary key in AX 2012

Hi Everyone, Hope you all doing well. I have come with the steps of creating the  single field as primary in AX 2012.

1) Create the Table and add required fields to the table as you all knows.
2) Create an Index by dragging the required field to the Index.
3) Set the following Index properties:
        a) AllowDuplicates to "NO".
        b) Alternate key to "YES".
4) Set the  PrimaryIndex  property of the table to newly created index after creating the Index. 

All The Best... :)

Please comment me your suggestions for my posts..