Sending mail in Dynamics AX without Outlook

In Dynamics one of our batch jobs should send out a mail to a speciffic user. This is the job I will use to do this.

static void SendMail(Args _args)
{
System.Net.Mail.MailMessage     mailMessage;
System.Net.Mail.SmtpClient      myMail;
System.Net.Mail.MailAddress     toMail;
System.Net.Mail.MailAddress     fromMail;
;
fromMail = new System.Net.Mail.MailAddress(“postmaster@domain.dk“);
toMail = new System.Net.Mail.MailAddress(“adam@domain.dk“);
mailMessage = new System.Net.Mail.MailMessage(fromMail,toMail);
mailMessage.set_Subject(“Enter the mail subject here”);
mailMessage.set_Body(“enter the mail body here”);
myMail = new System.Net.Mail.SmtpClient(“name of the smtp server”):
myMail.Send(mailMessage);
}

Creating a new layout for the project invoice

A few days ago I needed to create a new country layout for the project invoice in Dynamics. Here is a small guide how to create this setup. I will not describe how to modify the report/invoice. I will only describe how to setup the new report/invoice .

Step 1 – create the dispatcher class

Start by creating a new class named ProjInvoiceDispatcher_DK (or whatever country code you are creating the new layout for). This class must extend the class ProjInvoiceDispatcher_W.

final class ProjInvoiceDispatcher_DK extends ProjInvoiceDispatcher_W
{
}

Create a new method getMenuItemName as below

protected MenuItemName getMenuItemName()
{
return menuitemoutputstr(ProjInvoice_DK);
}

Step 2 – create the country specific report/invoice

Now create a copy of the existing project invoice reports. I used the report ProjInvoice_CZ and I renamed it to ProjInvoice_DK.

Step 3 – create an output menu item

Create an output menu item that points to the report created in step 2.

Step 4 – Modify the Base Enum ReportFormat_W

Add a new node named “Danish format”.

Step 5 – Setup Dynamics to use the new format

In the company that should use the new format go to Project/Setup/Forms/Form setup and select the invoice tab.

Select the new layout in the field “Country specific form”.

Step 6 – link the new dispatcher class

In order to activate the new setup a modification of the calss ProjInvoiceDispatch_W.construct() method must be made. Add the below code to the switch statement:

case ReportFormat_W::DanishFormat_DK     :

dispatcher = new ProjInvoiceDispatcher_DK();

break;

That’s it. Now all you need is to modify the ProjInvoice_DK report so that it meets your layout requirements. Enjoy J

Dynamics AX 4.0 sp2, Windows 2008 R2, SQL server 2008 R2

I have been testing an installation of Dynamics AX with the following setup:

SQL server
Windows 2008 R2 datacenter – 64 bit
MS SQL 2008 R2

AOS server
Windows 2008 R2 datacenter – 64 bit

Both servers are virtual and are running in a Microsoft Hyper V environment. The setup is not supported officially by several threads indicates that AX 4.0 will run fine in a virtual environment.

According to the Dynamics AX 4.0 system requirements this setup should be supported. The Dynamics AX kernel needs to be upgraded though according to the KB article 944115 (MBS customer source).

I did the upgrade and the AOS started fine. But when synchronizing the data dictionary the AOS crashed. I did a lot of investigation but I really never found an answer. Finally I found the kernel rollup in KB article 981007. I installed this kernel rollup and now the test installation is running smoothly on the setup.