Monday, October 31, 2011

Plan a Succesful AX 2009 System Topology

Hi,

Today I would like to talk about a topic that, when followed with professionalism, can differentiate a good consultant from a bad one.

If you think about it, Microsoft Dynamics AX has become the way to help companies become more efficient, and to also help them save money. However, is also true that AX (in general) has become a big boom where some (low quality) partners and developers are not following up certain guidelines to make an implementation a successful one.

The result ... Customer dissatisfaction and a bad taste for AX.

In this article I would like to discuss the basics to plan a good system topology. In other words, what do we need to have in mind when faced with this task. What kind of question should we be asking the customer.

For example,  A large business with multiple locations might experience different challenges compared to a smaller business with one location and only a few users.

So, a good tip would be to start the implementation process by (1) creating an inventory of the customer's current hardware and software, and (2) determining the deployment scenario that best meets the business’ current needs and future growth.

 So, before the actual installation occurs, we must collect information about the customer's requirements to help prepare the correct topology.

1- Define and document these items with the customer:
  • Number of transactions
  • Number of users
  • Uses of system (modules and features to be implemented)
  • External user access required
  • Web access required
  • Required availability
  • Projected growth rate
  • Number of sites

2- Evaluate and document the existing infrastructure:
  • Existing hardware
  • Bandwidth
  • Operating system
  • Databases present
  • Applications to integrate

3- After collecting this information, determine how to structure the system. Key decisions are as follows:
  • If there are any computer roles that can be combined on a single computer? If computer roles can be combined, consider which ones to combine.
  • Determine whether there are any network load-balanced clusters to host the AOS.
  • Select a backup system for the Microsoft Dynamics AX environment.

Topologies

If the customer's requirements are focused on not allowing users outside the domain, then use the following topologies:


Minimal Base Topology




Clustered Base Topology (You can install the application file server on a AOS server as you will have more than one AOS server)




Enterprise Portal Topology

There are two (1) Intranet (Simple and Large-Scale), and (2) Internet-Facing

Intranet



Intranet Large-Scale




Internet-Facing Enterprise Portal


Standard Perimeter Network
With a standard perimeter network the Active Directory domain contains:
  • All internal users to be added to Microsoft Dynamics AX 2009.
  • Special users required for Microsoft Dynamics AX functionality.
  • An organizational unit that contains any users from outside the organization that require Enterprise Portal access. These users’ rights must be restricted in that the users cannot:
                      Log on locally
                      Access network


Traditional Perimeter Network
Basically, the traditional perimeter network contains two Active Directory domains: the internal domain and the external domain. The internal domain contains:
  • All internal users to be added to Microsoft Dynamics AX 2009.
  • Special users required for Microsoft Dynamics AX functionality.
  • Group required for application integration server functionality.
[From Microsoft Training Material]
The perimeter network contains a second domain controller with a one-way trust relationship to the first domain controller. The second domain controller contains any users from outside the organization that require Enterprise Portal access.
These users cannot have any rights in the internal domain, and their rights must be restricted in the perimeter network domain so that the users cannot:
  • Log on locally
  • Access network

 Report Server Topology (This is installed on IIS and is not Internet-Facing)


Application Integration Server Topology (This is also installed in IIS and is not Internet-Facing)


Let's be consistent in the work that we do. Let's provide a great customer satisfaction so Microsoft Dynamics AX can keep growing and helping businesses succeed. By following the above suggestions, we can make a huge difference in how new businesses experience AX implementations.

Take care!

Thursday, October 27, 2011

AX 2009 Workflow - Run batch jobs through a Job

When working with Workflows, sometimes  have encountered a situation where my workflow item just don't run.
This might be due to a problem on the Batch Server. To test (run) the workflow mimicking the batch server we can write the following job.
static void workflowJobs(Args _args)
{
    SysWorkflowMessageQueueManager  queueManager;
    WorkflowWorkItemDueDateJob      workItemDueDateJob;
    ;

    queueManager = SysWorkflowMessageQueueManager::construct();
    queueManager.run();
    workItemDueDateJob = new WorkflowWorkItemDueDateJob();
    workItemDueDateJob.run();
}

Another alternative is to go to AOT > Forms > Tutorial_WorkflowProcessor and click the start button.

Unable to validate the AX 2009 Workflow Webservice URL on a Windows Server 2008 R2 x64 - The request failed with HTTP status 405: Method Not Allowed.

Hi,

I was having some issues yesterday validating an URL in Windows Server 2009 R2 - 64. I have done this a few times already and the process have been really smooth and straight forward. However, in the environment I'm working on right now I the The request failed with HTTP status 405: Method Not Allowed error.

I found this post that helped me solve the problem, which basically was changing the property value of the MicrosoftDynamicsAXWorkflow50 application pool in IIS Manager to "Enable 32-Bit Applications".

Here is the link:

http://blogs.msdn.com/b/emeadaxsupport/archive/2010/01/05/unable-to-validate-the-ax-2009-workflow-webservice-url-on-a-windows-server-2008-r2-x64.aspx

Configuring Kerberos Authentication with Enterprise Portal in AX 2009

Hi,

I remember the first time I had to setup the AX 2009 EP. Oh man, it was painful at the time and I wished I could have had the document I'm about to share/

In a way I feel lucky I had to do it and figure it out on my own as the document really makes sense, and I see now what where the steps I did not followed correctly.

Here is the link!

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=16080

How is X++ converted to MSIL

Hi,

I found a superb video about how Microsoft is translating  X++ code to MSIL. I remember that this great new model was anounced at Convergence 2011.

Here it is.

http://channel9.msdn.com/Blogs/Charles/Peter-Villadsen-and-Gustavo-Plancarte-Inside-Ax-Translator-X-to-MSIL

Thursday, October 6, 2011

Standalone AOS and AOS Clusters

The following is an explanation of some of the possible combination we can have when it comes to AOS’s in our environments.

For what I have learned over the years, we can have several different AOS setups, starting from a single AOS environment (usually used in a development and/or test machine) to a multi AOS (cluster) environment.

So, the following are the differences (based on my opinion)


Standalone AOS Environment

It is obvious that this is the simplest configuration. Usually, I would follow this pattern when I have to create a development and/or test environment. The reason is that for development scenarios (in small –mid companies) we don’t deal with 70 – 80 developers at a time.

In addition, we can add (if we want to) extra AOS servers if the need to handle a larger number of users and/or connections is necessary. This will create a side by side configuration.


Multiple AOS’s (not clustered)

As stated earlier, we know that multiple AOS's in a single Ax environment can exist side by side. Typically the way it works is that a user will connect to the AOS that has been configured in the AX configuration Utility. However, if we were to have more than one AOS listed in the AX configuration utility, the first available will be used to fulfill the connection request by a client.

I guess that if we are listing (and using) more than one AOS in our AX configuration utility is a good thing as this will ensure that a connection is guaranteed to the client because it will use the first available(except if all the AOS servers are down of course).

Side Note:  When using multiple AOS’s we can also define how the user connects to it. For example, in the project I’m working on right now we deal with two different time zones (USA and Asia), so in our cluster we define that the users in Asia will connect to AOS Asia, and the users in the US to the AOS US.

I guess the side note above opened the conversation to yet another type of setup, and this is the Clustered AOS.


There are two types of cluster mode for AOS.

1-      Cluster mode without Load Balancer
2-      Cluster mode with Load balancer


Cluster mode without load balancer

When a client starts, it sends a request to the first server that is listed in the client configuration. When this happens, the server returns the list of active AOS instances in the cluster, sorted by workload.  Then, the client attempts to connect to the first AOS instance in the list, and if that connection fails, the client attempts to connect to the second AOS instance in the list, and so on.
It will be logical to conclude that the only criteria to manage the load is the number of clients that are connected to a specific AOS, this includes threads, BC, etc.


Cluster with load balancer

If we set up a cluster that includes a load balancer, the load balancing AOS instance is dedicated to distributing the user load (NOTE: A load balancer AOS does not require a license nor does process Microsoft Dynamics AX business logic or data)

Side Note: We need to ensure to set up all the client configurations to connect ONLY to the load balancing AOS instance.

So when a client starts, it connects to the load balancing AOS instance. Then, the load balancing AOS returns a list of active AOS servers (instances) that exist in the cluster, usually sorted by the workload. Then, the client attempts to connect to the first AOS instance in the list. If that connection fails, the client attempts to connect to the second AOS instance in the list, and so on.

So, we can conclude that this is very similar to the non-clustered AOS mode, and I guess the only difference using a configuration like this is that we can add and/or remove other AOS instances from the cluster without updating client any of the configurations, which is really cool. Now the question is, even though the Load Balancer AOS is kind of free, do we really need it? Or what happens if the Load balancer AOS fails?


Channel 9 - AX 2009 AIF Web Services


The following link will take you to a Channel 9 screen cast where you can learn about the new features of the AX 2009 AIF Web Services.

The following are some of the enhancements to Application Integration Framework (AIF) in AX 2009 AIF Web Services.

1.       Create, read, update, and delete operations are now supported.
2.       The programming model for AIF supports document services that encapsulate business logic and are the interface between AX 2009 and external systems.
3.       AIF provides functionality for consuming external Web services from within X++.
4.       New document services for additional commonly-used documents.


http://channel9.msdn.com/Blogs/SanjayJain/Microsoft-Dynamics-AX-2009-AIF-Web-Services-Screencast

Wednesday, October 5, 2011

Loop through SELECTED records on an AX Form - AX 2009

We have the ability to loop through SELECTED records on a AX form in X++.

There are many ways to accomplish this in AX, but based on my requirements I made the choice of looping through the selected records in a button's click() method.


CustInvoiceJour                     localCustInvoiceJour;
FormDataSource                      form_ds;
Common                              common
;
 //super();

//Set form data source
form_ds = CustInvoiceJour_ds;

for(common = form_ds.getFirst(true)?form_ds.getFirst(true):CustInvoiceJour_ds.cursor(); 
     common;
     common = form_ds.getNext())
    {

        localCustInvoiceJour = common;

        …Implementation…
    }

Tuesday, October 4, 2011

Error code 122 - AX 2009

While modifying some code on my devlopment machine i came across the following error...
Error in file: D\MDAX\AppFiles\..while writing in record = 336985 Windows error: = Error code: 112 = Unknown Error
 The above error (based on the msdn description) means that the disk is full (ERROR_DISK_FULL: There is not enough space on the disk)
The problem is that the AOS is trying to save the changes I making to my code into the *aod files, but there is not enough space on the hard disk (in my case D) for it to accomplish that.
We can solve this problem by freeing up disk space on the AOS machine.

Monday, September 26, 2011

Code to refresh system tables in AX 2009 - SysClientSession Table

The following code will refresh the system tables in AX 2009. I had an issue with the SysClientSession table this morning and I found some documentation about from Microsoft where they suggest running a script to allow the syscronozation of systables.

The kernel uses the SYSTABVERSION parameter value in the SQL SystemVariables table to synchronize its list with the DataBase

The following were the errors I got:

1- The database reported (session 1 (-AOS-)): [Microsoft][SQL Native Client][SQL Server]Invalid object name 'SYSCLIENTSESSIONS'.. The SQL statement was: "SELECT A.SESSIONID,A.SERVERID,A.VERSION,A.LOGINDATETIME,A.LOGINDATETIMETZID,A.STATUS,A.USERID,A.SID,A.USERLANGUAGE,A.HELPLANGUAGE,A.CLIENTTYPE,A.SESSIONTYPE,A.CLIENTCOMPUTER,A.RECVERSION,A.RECID FROM SYSCLIENTSESSIONS A WHERE (SERVERID=?)"

2- Internal Error occurred executing stored procedure when creating session for the AOS.

Please backup your DB before running this script.

update SqlSystemVariables set value = value - 1 where parm = 'systabversion'

Once you do this please restart your AOS and the problem should be fixed.

Wednesday, September 14, 2011

AX 2009 Data Import / Export

The following post is about shows how to:
1-   Export data from a company in AX using a definition Group
2-   Creating a new company that will take the new data
3-   Importing the data exported from step 1 into the new company created in step 2 using a definition group as well.
In a current project, I needed to freeze the Test1 environment due to some focus testing of a certain functionality we implemented. At the same time, we needed to allow the uses to keep testing other customizations without affecting Test1.
In addition, to make the user’s lives easier, we decided to have the same data that they were using in Test1 in our Test2 instance. So, we exported the data from our Test1 environment, and then imported it to a new company in our Test2 environment.
The following steps will show this process step by step:

1-   First select the company you want to export the data from as the AX current company by clicking in company name in the right lower corner of your AX interface.

2-   This would open the “Select Company” form as shown;
3-   Select  Administration (module)
4-   Under periodic->Data exports /import ->Click Export to
5-   The “Export options” form will appear
6-   Select a definition group. You can either create a new definition group to include what you need, or just choose ALL to get all the tables.

NOTE: In some cases, the already defined “ALL” definition group will not have all the tables, so in this case you would have to create a new definition group. In my case I created a new one name “ALL_NewDef” that included the latest tables.

7-   Enter a file name and select where to save it
8-   Click OK. At this point the company date export process should be done (after processing of course), and the files (.dat & .def) should have be saved on your computer.

Now, let’s create a new company

9-   Make sure that the selected company empty and click area node Administration
10- Click company Accounts under Common forms
11-   Press (Ctrl + N) in order to Create new company
12-   Make sure you select the newly created company as the current company

Import company file already exported in the prior steps and click Administration


13- Under periodic->Data exports /import ->Click import; The “Import options” screen will appear
14- Select the “import definition group” drop down list and choose ALL (otherwise create your own)
15-   Select the .dat file (exported before) and Click Ok to start the process

The import process may take some time according to the size of transactions in the original (exported) company.
In addition, you can choose to delete all the transaction data before the import when you are importing a .dat file o an existing company account to update the data.

Thursday, August 25, 2011

Application Object Server (AOS) architecture

The Application Object Server (AOS) provides the infrastructure to execute the business logic of the Microsoft Dynamics AX application. The AOS handles the required connectivity, security, and database connection management. You can install the AOS on a single computer or on multiple computers and group these computers in a load-balanced cluster.

In Microsoft Dynamics AX 2009,you can create a single cluster or multiple clusters of AOS servers.

Microsoft Dynamics AX requires Windows-integrated authentication for all servers in the system, which means that you must be running Active Directory. For security reasons, the AOS must be installed on a Windows server operating system.

A system used for demonstrations, development, or testing can be set up to use more than one AOS instance. For details about developer installations of Microsoft Dynamics AX 2009, see the Installation Guide.
In Microsoft Dynamics AX, the AOS is implemented as a Microsoft Windows

Service to take advantage of the following features:
  • Windows service applications run in the security context of a specific user account that is different from any logged-on user or the default computer account. The AOS service uses a system account for authentication during start up. This account is used by the AOS to access the file server and database server.
  • A Windows service application runs in its own Windows session and takes advantage of the service control manager (SCM, a feature of the Windows Server 2003 operating system or higher) to maintain status information and to provide the user interface for managing the AOS.
  • Windows services can be configured to start at system startup or upon demand, and they continue to run even when no user is logged into the system.
  • Server status can be reported to the Windows event log, allowing administrators to view errors and warnings that can aid in troubleshooting problems.
The following diagram provides a view of the architecture of the AOS.




Wednesday, August 24, 2011

Microsoft Dynamics AX 2009 System architecture

The following post has been copied from - http://technet.microsoft.com/en-us/library/dd362112(AX.50).aspx

Microsoft Dynamics AX 2009 - Sytem architecture
Understanding the internal architecture of Microsoft Dynamics AX can help you make decisions when planning, customizing, and deploying a system. This topic provides a high-level overview of the system architecture of Microsoft Dynamics AX.

The diagram below provides a high-level overview of Microsoft Dynamics AX system architecture. This diagram does not depict the system topology or physical infrastructure required for the deployment.

Your infrastructure can consist of many Microsoft Dynamics AX components on a single physical server or on multiple physical servers. For considerations in planning your deployment infrastructure, see Planning system topology.

For details on Microsoft Dynamics AX components, see Component architecture. For up-to-date hardware and software requirements for Microsoft Dynamics AX, see the system requirements Web page.


Dd362112.System_architecture(en-US,AX.50).gif

Tuesday, August 23, 2011

AX 2012 - New Improvements in Data Security

The new version of AX offers many new features to all of us. These go from development improvements to data security, which is the one topic I would like to focus on in this post.

The following are the improvements with regard to data security:
  • Role-based security
  • Server-enforced security
  • Extensible data security framework
  • Flexible authentication

Role-based security
Data security is much easier to manage. In AX 2012, users are assigned to roles based on the duties and responsibilities they have and access is granted based on those roles. This change puts an end to the tedious and time-consuming process of assigning users based on application objects. Once set up, role assignments can easily be updated based on the business data.


Server-enforced security
Authorization is performed on the server rather the client, consistently enforcing permissions on protected fields regardless of the type of client. The server sends the client only the information that the user has been granted access to, resulting in increased data security.


AX 2009 did not offer the facility to use data security based on effective date. However, in AX 2012 administrators can specify whether users have access to past, present, or future records with different levels of access, which creates much for flexibility to all the different iteration in the use of data throughout the life of the application.

Further, the new version can also be used to create data security policies based on data contained in a different table.

For example, in previous versions you could not filter sales lines by customer location because those were stored in different tables, but the new version makes that totally possible.

Data security policies are enforced at the server regardless of the type of client used to access the data.

Flexible authentication
Authentication of users by methods other than Active Directory allowing external users to access Dynamics AX without a required domain account.

Wednesday, August 17, 2011

Setup Electronic Format Payment (EFT) in AX 2009

A few days ago I created a new post on how to create a new Electroni Payment Format (EFT) in X++. The post can be seen here: http://axwonders.blogspot.com/2011/08/create-electronic-payment-format-ax.html


In this post I will show how to setup the EFT based on the class I created before in AX 2009.


1 - Open Accounts Payable | Setup | Payment | Methods of Payments and create a new record as follows:


NOTE: I will be using a Payment Method called EFT Mexico for this example, but you can name this anything in the Interface method in the class you will create to customize an Electronic Payment.

In the link above look at the class named KUMVendOutPaym_SA and look for a method named PaymInterfaceName. You will see the following code:

public PaymInterfaceName interfaceName()
{
    ;
    return 'EFT Mexico';
}





Tuesday, August 16, 2011

Ax 2009 SSRS Videos

While looking for some information related to AX 2009 SSRS I found a bunch of videos related to SSRS and AX 2009.

Here is the link:

http://youtu.be/ZIoEZWaiBXI

Friday, August 12, 2011

LIKE Operator in X++

In Axapta, we can use the LIKE operator in an inline SQL statement, see the following:


select * from VendTable where VendTable.Name like 'P*'


Another example is to use the LIKE operator to compare strings!


static void MyTestForLike(Args _args)
{


    str test;
    ;

    test="Eduardo";

    if(test like "Eduar*")
       info('Hello Ed!');


}

Monday, August 1, 2011

Create Electronic Payment Format - AX 2009

Electronic payments are being used heavily today. It is importnat to understand how these work and how to implement them as they save lots of time and even more paperwork. In addition, AX 2009 provides some out-of-the-box payment templates, but they are not very felxible and very often we need to create our own.

Now the good thing about creating our own is that we can inherit from two base classes. (1) VendOutPaym and (2) VendOutPaymRecord.

VendOutPaym is ussually used to create the header and closing records of a payment file. On the other hand, VendOutPaymRecord is used to create the the lines records of the payment file. So, if we have a payment journal (AP > Journals > Payments> Payment Journal) with 10 lines, we should see only one header line, (in my case) only one Bank line (after header), 10 line records (Payment journal lines) and one closing line with totals, got the idea?

So, we would have to create two classes. One to write the header and closing records and one to write the journal lines, ok?

Here is the first class to write header and closing records. Because in my file the empey spaces needed to be filled with only 0's, I created a method that's called getProcessedStr that takes a string and an integer. The string is the actual value that will be written into the file but needs extra 0's. The int is the total lenght of this record in the text file.


Wednesday, July 27, 2011

strRem Function - Delete a Character from String - AX 2009

The following code searches a specified string character and deletes it. The cool thing about this function is that it is case sensitive.


str strRem(str text1, str text2)
text1  The string from which to remove characters.
text2 The characters to exclude from the output string.

For example:

strRem("MynameIs","is"); //Returns the string "MynameI".

Tuesday, July 26, 2011

Wednesday, July 20, 2011

Create Electronic Invoice to Text File Format - Ax 2009 -

 The following code is to create a company country specific requirement. In addition, the logic is specific to the needs of my customer, but I'm sure you will be able to find great examples on how to create directories with WinApi and manipulate text files with the TextIO function.

The project flow is as follow:

1- The user posts an invoice
2- After the invoice has been posted, the KMN_eInvoiceCreation class is called with parameters  (This call is not posted here)
3- The class has several methods from creating the path file name, to writing a very specific logic into a text file.
4- The class saves the file into a specific location

The project produces the following text file contents:

DC|3.0|||15/07/2011|Pago en una sola exhibición||150.22|||||270.02||I
EM|KIE9512187VA|Compania de Ventanas S.A.

DF|Juytyu|130|Piso 7 y 8, Desp.801|Lostre|||MiguelHidalgo|DF|Mexico|999
RC|TORE621221HP9|Elizabeth Araya Reyes
DM|Teaneck|308||Warrrr|||Guadalupe|NL|Mexico|986589

CN|1.00|||Libro de Respuestas 3A/2A/A|25.00|25.00
CN|1.00|||Diploma de Finalización 7A|2.61|2.61
CN|1.00|||Diploma de Finalización 6A|2.61|2.61
CN|1.00|||Flashcards 1-50|120.00|120.00
IA|102433660003476|08/10/2010|Laredo
IT|IVA|33.80|16.00
TI||33.80


This project uses a custom table to store all the SalesParmTable data as we needed to provide a way for the user to re-run a posted invoice.

The following are the base enums I'm using.

Friday, July 15, 2011

SubStr function - Axapta

str SubStr (str _text, int _position, int _chars)

SubStr("MyString",20,3);  // Returns ""
SubStr("MyString ",4,50);  // Returns "tring"

Monday, July 11, 2011

Create loop from an AX form DataSet - Ax 2009

Sometimes we need to loop through values at the form level. The following code loops (for loop) the SalesParmTable in the CloseOk() Form method.        


        //Create Lines
        for (localSalesParmTable = salesParmTable_ds.getFirst();
              localSalesParmTable;
              localSalesParmTable = salesParmTable_ds.getNext())
        {

              ....Implementation....
        }

Code to check for "garbage" in the ReleaseUpdateScripts table - AX 2009

ReleaseUpdateScripts    releaseUpdateScripts;
Counter                 total;
Counter                 invalid;
;
while select ClassID
    from    releaseUpdateScripts
    group by ClassID
{
    total++;
    if (classid2name(releaseUpdateScripts.ClassID) == '')
    {
        info(int2str(releaseUpdateScripts.ClassID));
        invalid++;
    }
}
info(strfmt(@"Found %1 invalid classIds out of %2", invalid, total));

Wednesday, July 6, 2011

Workaround to Exception::CLRError using System.IO.StreamWriter

In one of my projects I was using the System.IO.StreamWriter to write data into a text file in X++. Everything went well until I started testing for exception in order to handle them (the System.IO is a .Net class that allows us to maniluplate file operations, including folders. So, I though in catching the exception with the Exception::CLRError one. )

The problem I was having was that when an exception was raised by a problem creating the file (Incorrect file name), the operation will not fall into the Exception::CRLError exception, Instead, it would just crash and I wasn't able to properly handle the exception.

The reason for this is that when using an AX class that runs on the server, the exception never comes back to the client and therefore cannot be handled correctly. I'm using the SalesFormLetter class main method to call my own class after an invoice is generated, and this class (SalesFormLetter) is (1) an abstract class and (2) runs on the server and I really did not want to do this.

A workaorund is to use the TextIO class in AX along with the FileIoPermission. For example, when using the TextIo to create (and/or overwrite) a file, we get a null value when the file could not be created (and/or overwritten). Then, we can throw an exception when the object is null.

In my case I have a central class that handles all errors, so when the TextIO object is null, I call this class and I throw an error, then the error comes back to my method and falls into the Exception::Error exception.

The following is the code