Search This Blog

Wednesday, 28 December 2011

AX Error :You are not a recognized User of Microsoft Dynamics AX. Contact your system administrator for the help

Error:
You are not a recognized user with admin righof Microsoft Dynamics AX. Contact your system administrator for the help


Solution:
Ask the user with admin rights to give u access in the ax through admin module>user form .


If this error is in your local PC then see the username in the dynamics services and then try to login from those credentials and give rights to the user .

AX Error:Connection with the Application Object Server could not be established.

Connection with the Application Object Server could not be established.


If you get the above error 
GOTO start>run>cmd>services.msc




Start the dynamics ax service .


The problem gets resolved.

AX is too slow

If your Dynamics AX is not responding as fast as it should be then you should delete the logs in the following location since they are of no use.


C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS

Logs Files which are no use…

SQL reporting Permissions Error


Recently I came across  permission error regarding rights in SQL Reporting services as shown below.
I followed the steps below and the error went away.


After providing valid credentials, you will most likely receive the following error message when trying to access either the Report Manager or Report Server for the first time:
User '<domain>\<UserAccount>' does not have required permissions.
Verify that sufficient permissions have been granted and Windows
User Account Control (UAC) restrictions have been addressed.
SQL Server Reporting Services Permissions Error
This article provides a solution to this common permissions error you may receive while attempting to authenticate to the Report Server or Report Manager.

Solution

It appears obvious from the error message that additional privileges are required for the Windows user account you are logged in as before access can be granted to the Report Server. You soon realize, however, that not only are you logged in as a member of the local Administrators group on the machine, but you are logged in as the Windows domain account that is running the Report Server service! I'm not certain why, but it appears you must start your Web browser (Internet Explorer or Firefox) as an Administrator to access Reporting Services. To do this, click on the Windows Start menu, locate your Web browser, and then right-click the icon to choose the Run as administrator option.
Run Web Browser as Administrator
Re-enter the URL for the Report Manager (http://<ServerName>/Reports) and you should see a screen similar to the following:
Report Manager Screen
To setup security in SQL Server Reporting Services so that the 'Run as administrator' option is not required when starting the Web browser, bring up Report Manager (http://<ServerName>/Reports), and then click Site Settings in the upper right hand corner.
Site Settings
Next, click Security on the left hand side and then click the New Role Assignment option.
New Role Assignment
This will take you to a page were new users can be added with different levels of security (System Administrator or System User) at the Site level. You need to assign the Windows User Account (or Group) the System Administrator role so that you no longer have to use the 'Run as administrator' option when starting the Web browser from that user account. For this example, I will be assigning the System Administrator role to the Windows domain account IDEVELOPMENT\SQLServerAdmin at the Site level. For a production environment, I would recommend creating both new System Administrators and System Users to control the separation of roles for the Report Server.
Assign System Administrator Role to Domain User Account
You will be returned to the Site Settings page where you can verify that the Windows User Account or Group was assigned the appropriate role.
Verify New Role Assignment
In addition to setting the system roles at the Site level, you must also setup roles for the actual Folder/Viewing level. To do this, return to Home, and then click Folder Settings.
Folder Settings
You should then see a Security Setting page similar to the previous one. Click New Role Assignment.
New Role Assignment
For a production environment, I would recommend that the user assigned the System Administrator role at the Site level, also be granted the Content Manager role at this level. System User level users and groups may only need the minimum role of Browser; however, this depends on the security policies within the organization. For this example, I will be assigning all roles at this level to the Windows domain account IDEVELOPMENT\SQLServerAdmin.
New Role Assignment
You will be returned to the Home page where you can verify that the Windows User Account or Group was assigned the appropriate role.
Verify New Role Assignment
Exit from the Web browser and restart it to ensure you can authenticate to the Report Server without needing to use the 'Run as administrator' option.

Thursday, 8 December 2011

Color forms in ax Environments

Color forms in ax Environments


There is a way to change the color of the Dynamics forms to help indicate what environment is in use. It involved overriding the SysSetupFormRun.run() method, which will be called every time a form is opened. On the class SysSetupFormRun, 
create a new method with this code:


public void run()
{
SysSQLSystemInfo systemInfo = SysSQLSystemInfo::construct();
; 

super();


// Set the color scheme of this instance of the SysFormRun to RGB
this.design().colorScheme(FormColorScheme::RGB);


// If the database name is not the live version, change the color of the form

if (systemInfo.getloginDatabase() != 'MyDBName')
this.design().backgroundColor(0x112255);
}

Connect to an external DB from AX


Connect to an external DB from AX 

This is achieved by using the ODBC protocal through the OdbcConnection class.


1. Create a DSN
To create a Data Source Name (DSN) go to Administrative Tools > Data Sources (ODBC).
Create the DSN on the tier where the X++ code will call the DSN from. This will be either on the client computer or on the AOS computer.
2. X++ code
static void TestOdbcJob()
{
    LoginProperty login;
    OdbcConnection con;
    Statement stmt;
    ResultSet rs;
    str strQuery, criteria;
    SqlStatementExecutePermission perm;
    ;

    // Set the information on the ODBC.
    login = new LoginProperty();
    login.setDSN("dsnName");
    login.setDatabase("databaseName");

    //Create a connection to external database.
    con = new OdbcConnection(login);

    if (con)
    {
        strQuery = strfmt("SELECT * from tableName WHERE XXX = ‘%1′ ORDER BY  FIELD1, FIELD2", criteria);

        //Assert permission for executing the sql string.
        perm = new SqlStatementExecutePermission(strQuery);
        perm.assert();

        //Prepare the sql statement.
        stmt = con.createStatement();
        rs = stmt.executeQuery(strQuery);
     
        //Cause the sql statement to run,
        //then loop through each row in the result.
        while (rs.next())
        {
            //It is not possible to get field 2 and then 1.
            //Always get fields in numerical order, such as 1 then 2 the 3 etc.
            print rs.getString(1);
            print rs.getString(2);
        }

        //Close the connection.
        rs.close();
        stmt.close();
    }
    else
    {
        error("Failed to log on to the database through ODBC");
    }
}

Current company in AX /Get Active company's name in AX


Get the active company in AX 2009 - curExt()

Use the curExt() function to get the active company in AX;

static void curExtExample(Args _arg)
{
str CompanyId;
;

CompanyId = curExt();
Info(CompanyId);
}

Or else you can also use the following code.

static void curExtExample(Args _arg)
{
str CompanyId;
;

CompanyId = CompanyInfo::Find().DataAreaId;
Info(CompanyId);
}