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);
}

Select Multiple Records in AX 2009.


X++ code to identify multiple selected records in Grid
Steps :
1. Create a new method on form and copy the following code.
2. Next create a button on form . and call the method on the button click event.
(for the button property makesure the Multiselect should be set to yes )

void checkSelectedRecords()
{

InventTable inventLocal;
;
//getFirst method gets all the selected records in the grid
inventLocal = InventTable_ds.getFirst(true);

while (inventLocal)
{
info(strfmt("You selected Item %1",inventLocal.ItemId));
// get the next selected record
inventLocal = InventTable_ds.getNext();
}
}



You can also select all the records by ctrl+shift

Email Through Code in AX 2009



static void sendEmailThroughOutlook(Args args)
{
SmmOutlookEMail smmOutlookEMail = new SmmOutlookEMail();
Object smmSendEmail;
;
args = new Args();
args.name(formstr(smmSendEmail));
args.caller(smmOutlookEMail);
smmSendEmail = classfactory.formRunClass(args);

if (smmSendEmail)
{
smmSendEmail.init();
smmSendEmail.setEmailTos("xyz@gmail.com");
smmSendEmail.setEmailSubject("jit");
smmSendEmail.setAttachments(["d:\jit.txt"]);
smmSendEmail.run();
smmSendEmail.refreshControl();
smmSendEmail.wait();
}

Tuesday, 6 December 2011

Import Data in Excel


Make a new project with the following class.
class SDExcelExport{}
public static void main(Args args)
{

CustTable custTable;
SysExcelApplication application;
SysExcelWorkBooks workbooks;
SysExcelWorkBook workbook;
SysExcelWorksheets worksheets;
sysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
int row;

;

application = SysExcelApplication::construct();
workbooks = application.workbooks(); //gets the workbook object
workbook = workbooks.add(); // creates a new workbook
worksheets = workbook.worksheets(); //gets the worksheets object
//The following selects the first worksheet in the workbook to insert data
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
// numberFormat ‘@’ is to insert data as Text

cells.range('A:A').numberFormat('@');
while select custTable
//The following loop will provide the data to be populated in each column
{
row++;
cell = cells.item(row,1);
cell.value(custTable.AccountNum);
cell = cells.item(row,2);
cell.value(custTable.Name);
cell = cells.item(row,3);
cell.value(CustTable.CustGroup);
cell = cells.item(row,4);
cell.value(CustTable.Currency);
cell = cells.item(row,5);
cell.value(CustTable.CreditMax);
cell = cells.item(row,6);
cell.value(CustTable.CreditRating);
}
application.visible(true); '// opens the excel worksheet
}

Change the property of AX Table field /Find table wtth given property.


The X++ job below shows how to find all tables in the AOT where the SaveDataPerCompany property is set to No.
static void findAOTObjectByProperty(Args _args)
{
#AOT
TreeNode treeNodeTables = TreeNode::findNode(#TablesPath);
TreeNode treeNode;
str strPropertyName = 'SaveDataPerCompany';
str strPropertyValue = 'No';
;
// first table
treeNode = treeNodeTables.AOTfirstChild();
while (treeNode != null)
{
if (treeNode.AOTgetProperty(strPropertyName)== strPropertyValue)
{
info(treeNode.AOTname());
}
// next table
treeNode = treeNode.AOTnextSibling();
}
}

List of AX Tables /Tables fields in dynamics AX through job


static void findTablesinAX(Args _args)
{
    Dictionary      dictionary;
    TableId         tableId;
    tableName       tableName;
    ;
    dictionary = new Dictionary();
    tableId = dictionary.tableNext(0);
    tableName = dictionary.tableName(tableId);
    while (tableId)
    {
        info(strfmt("%1 - %2",int2str(tableId), tableName));
        tableId = dictionary.tableNext(tableId);
        tableName = dictionary.tableName(tableId);
    }
}

static void FindTableFields(Args _args)
 {
TreeNode node = TreeNode::findNode(@'\Data dictionary\Tables\CustTable\Fields');
TreeNode childNode;
TreeNodeIterator nodeIT;
                                                       tab
nodeIt = node.AOTiterator();
childNode = nodeIt.next();
while(childNode)
{
    info(strfmt("PBATable %1", childNode.treeNodeName()));
    childNode = nodeIt.next();
}
}

Llist of tables related to specific configuration keys


static void FindTablesFromConfigKey(Args _args)
{
// The name of the configuration key to be specified here
str configKeyName = "Prod";
Dictionary dictionary = new Dictionary();
ConfigurationKeyId configKeyId = dictionary.configurationKeyName2Id(configKeyName);
TableId tableId;
DictConfigurationKey dictConfigurationKey;
DictTable dictTable;
container keyIds;
int i;
;

if (configKeyId)
{
// Find all children of the specified configuration key
for (i = dictionary.configurationKeyNext(0); i; i = dictionary.configurationKeyNext(i))
{
dictConfigurationKey = new DictConfigurationKey(i);

while (dictConfigurationKey.parentConfigurationKeyId())
dictConfigurationKey = new DictConfigurationKey(dictConfigurationKey.parentConfigurationKeyId());

if (dictConfigurationKey.id() == configKeyId)
keyIds += i;
}

// Find all tables that have an appropriate configuration key
i = 0;
for (tableId = dictionary.tableNext(0);tableId;tableId = dictionary.tableNext(tableId))
{
dictTable = new DictTable(tableId);
if (!dictTable.isMap() && !dictTable.isTmp() && !dictTable.isView())
{
if (confind(keyIds, dictTable.configurationKeyId()))
{
i++;
info(dictTable.name());
}
}
}
}

info(strfmt("%1 tables have configuration key '%2'", i, configKeyName));
}

Sunday, 3 July 2011

MICROSOFT DYNAMICS AX RECORDED WEBCASTS



This is a great source guys go through it via the link
Webcast TitleTopic AreaRecorded Date
Microsoft Dynamics AX 2009 General Functional Overview DemoGeneral AXOctober 23, 2008 - Video
Microsoft Dynamics AX 2009 General Technical Overview DemoGeneral AXNovember 6, 2008 – Video
Live Webcast: Upgrading to Microsoft Dynamics AX 2009General AXNovember 4, 2009 – Video
Microsoft Dynamics AX 2009 Financial Module DemoFinanceNovember 20, 2008 – Video
Microsoft Dynamics AX 2009 Project Accounting Module DemoAccountingJanuary 14, 2009 – Video
Microsoft Dynamics AX 2009 CRM Module DemoCRMJune 2, 2010 – Video
Microsoft Dynamics AX 2009 CRM Module DemoCRMFebruary 25, 2009 – Video
Live Webcast: Microsoft Dynamics AX 2009 Inventory ManagementTrade & LogisticsOctober 21, 2009 – Video
Live Webcast: Microsoft Dynamics AX 2009 Enterprise PortalEnterprise PortalNovember 18, 2009 – Video
Learn More about Inventory II: A Powerful Extension of the Standard Microsoft Dynamics AX Inventory ModuleAX Extension-Inventory ManagementApril 1, 2009 – VideoMarch 31, 2010 –Video
Learn More about Inventory II: Another look at Inventory II: A Powerful Extension of the Standard Microsoft Dynamics AX Inventory Module from a Financial Users’ PerspectiveAX Extension-Inventory ManagementMay 5, 2010 – Video
AX-SMART Graphical Planning and Scheduling: An integrated drag and drop based planning and scheduling extension for AX production and project modulesAX Extension-Inventory ManagementJune 23, 2009 – VideoJanuary 13, 2010 –VideoJune 16, 2010 – Video
Learn More about TARGIT Business Intelligence SoftwareAX Extension – BIJuly 15, 2009 – Video
Better and faster decision making is only clicks away in Microsoft Dynamics AX with ASi’s Complete Business Intelligence Suite (Powered by timeXtender)AX Extension – BIMay 21, 2010 - VideoJuly 23, 2010 - Video

Display images in Axapta


Axapta provides a very handy feature to allow developers to ship their solution with Axapta built-in image files. In Application Object Tree, you can find resources node. Select resources node and right click; select Create from file, specify the file location for the new resource file. After that you can use this resource file in Axapta without specifying an absolute file path in your hard disk.
Then let’s see how to use this kind of files in Axapta.
First, pick up the resource node from AOT;
SysResource::getResourceNode();
Then generate a temporary file for this resource file;
SysResource::saveToTempFile()
Finally specify the temporary file path for controls.
Here comes an example to show how to use a resource file as a background image of  a given form.
    {        ResourceNode            resourceNode;
FilePath  imagename;
;
resourceNode = SysResource::getResourceNode(resourcestr(yourResourceName));
if (resourceNode)
{
resourceNode. AOTload();
imagename =  SysResource::saveToTempFile(resourceNode);
}
else
{
throw Error(“No file …exists.”)
}
        element.design().imageName(imagename);
    }

How to identify unused labels in application


A job to identify unused labels in application .
Here my label file is IFC
static void I4C_UnusedLabels(Args _args)
{
str 50  labelId;
int  i;
int  maxLabel = 2000;
xRefNames  names;
XRefReferences  ref;
str info = “LabelId#LabelStr\n”
;
while (i <= maxLabel)  {
labelId = “@IFC” + int2str(i);
// The particular label file.
select recid from names
where names.Name == labelid
exists join ref
where names.RecId == ref.xRefNameRecId;
if (! names.RecId)
{
info += strfmt(“%1#%2\n”, labelId,
SysLabel::labelId2String(labelId));
}
i++;
}

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...