December 05, 2012

Dynamics Ax Layers

 Dynamics Ax Layers

Dynamics AX 2009 consists of sixteen application object layers that contain all the
elements you see in the AOT.
These layers can be looked at as an onion with multiple layers. In the middle is the
core application in the SYS layer and the outermost layer is the user layer USR.
Therefore, when any application element is being executed the system will look at
the outermost code layer first to see if there is any code for that element; if not, it peels a layer off the onion, and tries the next layer. When it hits a layer where the element exists, it will use the code from this layer, and will not continue to peel off layers to find code for that element in the innermost layers.
Layers with their description



SYS The standard application is implemented at the lowest level,
the SYS layer.The application objects in the standard
application can never be deleted.

GLS Country/region specific changes will be developed in GLS
Layer.For e.g as you all know that Tax structure differs
from country to country.So such localization functionality
can be developed in GLS layer.

HFX HFX is an application object patch layer reserved by
Microsoft for future patching or other updates.

SL1, SL2,or SL3 A layer where the distributor can implement
vertical partner solutions.

BUS When a business partner creates their own generic solution,
their modifications are saved in the BUS layer and the top-
level application objects are used.

VAR Value Added Resellers (VAR) can make modifications or new
developments to the VAR layer as specified by the customers
or as a strategy of creating an industry-specific solution.
Such modifications are saved in the VAR layer.

CUS The supervisor or administrator of an end user installation
might want to make modifications that are generic to the
company. Such modifications are saved in the CUS (CUStomer)
layer.

USR End users might want to make their own modifications, such
as in their reports.These modifications are saved in the USR
layer.
-Harry

December 04, 2012

Workflow configuration error in Dynamics Ax: 401 Unauthorized

 Workflow configuration error in Dynamics Ax: 401 Unauthorized
Some times we faced unusual error after installing Dynamics AX Workflow: “401 Unauthorized” after running Workflow infrastructure configuration wizard
 (Dynamics AX –> Administration –> Setup)
at the first time installation of Dynamics Ax then you should go through the following steps….
It is mainly happening when database, AOS, Application and workflow servers are individual (especially workflow & AOS and Database server)
  1. Check AOS Service is running under an active domain user (domain\username)
  2. Workflow website and workflow application pool are having the same .NET Business Connector user name Identity (and of course, this should be an active domain user)
  3. You added the workflow website (http://servername:portnumber/DynamicsAXWorkflow50 for example) to the trusted sites in Internet Options of AOS server
  4. Run the following on the Workflow server:
  • After checking above points and then perform the following steps
  1. Start a command prompt.
  2. Locate and then change to the directory that contains the Adsutil.vbs file. (By default, this directory is C:\Inetpub\Adminscripts.)
  3. Type the following command, and then press ENTER: cscript adsutil.vbs set w3svc/NTAuthenticationProviders “NTLM”
  4. To verify that the NtAuthenticationProviders metabase property is set to NTLM, type the following command, and then press ENTER: cscript adsutil.vbs get w3svc/NTAuthenticationProviders
The output:
NTAuthenticationProviders       : (STRING) "NTLM"

After completing above procedure successfully then please take a restart of Ax and IIS service and then workflow infrastructure configuration wizard will work fine.

-Harry




December 01, 2012

Open web pages from X++ code

Sending mail from AX using .NET Framework

Sometimes happen that SysMailer class (using CDO) is not the right solution for sending mails with attachments. There is a little sample of X++ Job that is using System.Net.Mail namespace to achieve same.


static void JobNETSendMail(Args _args)
{
    System.Net.Mail.MailMessage             mailMessage;
    System.Net.Mail.Attachment              attachment;
    System.Net.Mail.AttachmentCollection    attachementCollection;
    System.Net.Mail.SmtpClient              smtpClient;
    System.Net.Mail.MailAddress             mailAddressFrom;
    System.Net.Mail.MailAddress             mailAddressTo;
    str                                     strBody;
    str                                     strSMTPServer;
    str                                     strFileName;
    FileIOPermission                        perm;
    ;

    // preparing parameters
    mailAddressFrom = new System.Net.Mail.MailAddres"test@localmail.com", "");
    mailAddressTo = new  System.Net.Mail.MailAddress("admin@localmail.com","");
    strBody = "There is a email body";
    strSMTPServer = "MailServerName";
    
    // preparing mail with body, subject, from, to.
    mailMessage = new System.Net.Mail.MailMessage(mailAddressFrom, mailAddressTo);
    mailmessage.set_Subject("There is a email subject");
    mailmessage.set_Body(strBody);
    attachementCollection = mailMessage.get_Attachments();

    strFileName = "C:\\path\\filename";
    // assert permision
    perm = new FileIOPermission(strFileName,'w');
    perm.assert();

    // attaching file to that email.
    attachment = new System.Net.Mail.Attachment(strFileName);
    attachementCollection.Add(attachment);
    smtpClient = new System.Net.Mail.SmtpClient(strSMTPServer);
    smtpClient.Send(mailmessage);
    
    // release permision
    CodeAccessPermission::revertAssert();
}

-Harry

November 24, 2012

The MorphX Tools - Project Designer

How to Create a Project in AXapta

For a fully customizable overview of the elements, you can use projects. In a project, elements can be grouped and structured according to the developer’s preference. The Project Designer is a powerful alternative to the AOT because you can collect all the elements needed for a feature in one project.
Creating a New Project
You open the Project Designer by clicking the Project button on the toolbar. Figure 1 shows the Project Designer and its Private and Shared projects.

Figure 1. Project Designer, showing available private and shared projects


Except for its structure, the Project Designer behaves exactly like the AOT. Every element in a project is also present in the AOT.
When you create a new project, you must decide whether it should be private or shared among all developers. You can’t set access requirements on shared projects. You can make a shared project private (and a private project shared) by dragging it from the shared category into the private category.

Note
Central features of Dynamics AX 2009 are captured in shared projects to provide an overview of all the elements in a feature. No private projects are included with the application.
You can specify a startup project in the Options dialog box. If specified, the chosen project automatically opens when Dynamics AX is started.

Automatically Generated Projects
Projects can be automatically generated in several ways—from using group masks to customizing special project types—to make working with them easier. We discuss the various ways to automatically generate projects in the sections that follow.

Group Masks
Groups are folders in a project. When you create a group, you can have its contents be automatically generated by setting the ProjectGroupType property (All is an option) and a regular expression as theGroupMask property. The contents of the group are created automatically and kept up to date as elements are created, deleted, and renamed. Using group masks ensures that your project is always current, even when elements are created directly in the AOT.
Figure 2 shows the ProjectGroupType property set to Tables and the GroupMask property set to <xRef on a project group. All table names starting with xRef (the prefix for the Cross-reference tool) will be included in the project group.

Figure 2. Property sheet specifying settings for ProjectGroupType and GroupMask

Figure 3 shows the resulting project when the settings from Figure 2 are used.

Figure 3. Project created by using group masks


Filters
You can also generate a project based on a filter. Because all elements in the AOT persist in a database format, you can use a query to filter elements and have the results presented in a project. You create a project filter by clicking the Filter button on the project’s toolbar. Depending on the complexity of the query, a project can be generated instantly or might take several minutes.
Filters allow you to create projects containing the following kinds of elements:
  • Elements created or modified within the last month
  • Elements created or modified by a named user
  • Elements from a particular layer

Development Tools
Several development tools, such as the Wizard wizard, produce projects containing elements the wizard creates. The result of running the Wizard wizard is a new project that includes a form, a class, and a menu item—all the elements comprising the newly created wizard.
You can also use several other wizards, such as the Report Wizard and the Class Wizard, to create projects. You can access these wizards from the Microsoft Dynamics AX drop-down menu by clicking Tools\Development Tools\Wizards.

Layer Comparison
You can compare all the elements in one layer with the elements in another layer, called the reference layer. If an element exists in both layers, and the definitions of the element are different or the element doesn’t exist in the reference layer, the element will be added to the resulting project. You can compare layers by clicking Tools\Development Tools\Code Upgrade from the Microsoft Dynamics AX drop-down menu.

Upgrade Projects
When you upgrade from one version of Dynamics AX to another or install a new service pack, you need to deal with any new elements that are introduced and existing elements that have been modified. These changes might conflict with customizations you’ve implemented in a higher layer.
The Create Upgrade Project feature makes a three-way comparison to establish whether an element has any upgrade conflicts. It compares the original version with both the customized version and the updated version. If a conflict is detected, the element is added to the project.
The resulting project provides a list of elements to update based on upgrade conflicts between versions. You can use the Compare tool, to see the conflicts in each element. Together, these features provide a cost-effective toolbox to use when upgrading.
You can create upgrade projects by clicking Tools\Development Tools\Code Upgrade\Detect Code Upgrade conflicts from the Microsoft Dynamics AX drop-down menu.

Project Types
When you create a new project, you can specify a project type.  Two specialized project types are also provided in Dynamics AX:
  • Test project Project used to group a set of classes for unit testing
  • Help Book project Project used for the table of contents in the online Help system
You can create a custom specialized project by creating a new class that extends the ProjectNode class. Specialized projects allow you to control the structure, icons, and actions available to the project.

-Harry