Thursday, March 29, 2012

Microsoft Dynamics AX 2012: Programming Model Improvements - Part 1

Here are a some info from a lecture on improvements in Ax2012 programming part 1. You will find the complete and free video (1 hr 15 min) presentation at Microsoft Partner Training web (BTW: You will need an account there):

Course description: The investment in tooling and framework improvements for the developer is vast. In this session see a snapshot of the investments in three key areas: Data access, the X++ language, and in the Services programming model. Data access abstractions like Relationship Modeling, Table Inheritance, Date Effectivity, Unit of Work and improved Caching will be covered. Also covered will be the X++ features of Eventing based customization and strongly typed interop from .NET to X++ that help you develop robust customizations for Microsoft Dynamics AX 2012. Finally we will provide an overview of Servic It's about writing less code and writing better code!es programming model that is geared towards opening up development for Dynamics AX to a whole variety of application platforms, including mobile platforms via standards compliant web services.

Screenshots from the videopresentation (c) 2011 Microsoft

Monday, March 26, 2012

Grid search filter

When you have focus on a form grid, you can press Ctrl-G to get a seach filter
like this one:



If you want to have this as default in a form, you will only need 2 code lines in the run method on that form and switch the autodeclaration on for the grid that need this:


Here is a code example (if there is no run method in your form, just create one):

#SysTaskRecorderMacro
public void run()
{
    super();

    // <- Turn the autofilter on in the grid
    grid.enter();
    this.task(#sysTaskRecorderTaskFilterByGrid); // Macro = 2855
    // Autofilter on ->
}





Wednesday, March 21, 2012

XPO Viewer

Here is a cute little XPO viewer. I have tested it with Ax 2009 and i works. I use it to have a quick look inside XPO's before I import it. You will only see a list of objects not the code.

Screenshot:

Monday, March 5, 2012

Emails

If you need to send emails from Ax 2009, you have several options:

1. Using the Microsoft CDO library for sending email like mentioned on this blogg.
2. The Ax SysMailer class (MSDN).
3. For Lotus Notes integration there is several 3rd party kits, like this one called Intograte (I have used this one several times).
4. Flat file: Most email services accept ASCII files as input that is formated according to the MIME standard. You just build the text string and write it to the file.

Please comment if you have other ways to generate/send emails....

Thursday, March 1, 2012

Query information in a report header

Today I had a case where I needed the user entered report query shown in the header like this (BTW: It's Norwegian language i the query dialog/report, but you will figure out what I mean):




All you need is to create the "showHeader" method shown below and use it in the pageheader or wherever you need to see this information.

The Code:
display formLetterTxt showHeader()
{
   int i,j,CurFieldID;
   formLetterTxt headerInfo;
   str CurPName;

   for (i=1;i<=element.query().dataSourceCount();i++)
   {
      for (j=1;j<=element.query().dataSourceNo(i).rangeCount();j++)
      {
         CurFieldID=fieldname2ID(element.query().dataSourceno(i).table(),element.query().dataSourceNo(i).range(j).name());
         CurPName=FieldID2pName(element.query().dataSourceno(i).table(),curFieldID);
         headerinfo+=(headerinfo ? '\n' : '')+curPName+':'+ element.query().dataSourceNo(i).range(j).value();
      }
   }

   return strfmt("Rapportparametere benyttet:\n%1",headerinfo);
//Translates to:   return strfmt("Rapportparams used:\n%1",headerinfo);
}