My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

10 June 2011

Set mail recipient and mail subject during posting

by Patrik Luca 4 comments

Tag



Business requirement: automatic setting of mail recipient and mail subject during posting

This post describes how to set the mail recipient and mail subject dynamically, but in an automatic way upon posting the packing slip for a purchase order. The printed packing slip is added as PDF to the created mail message. The solution is on an Axapta 3.0 installation, but probably the same can work for other Dynamics AX versions.

Solution

Create a new method in the class PurchFormLetter_PackingSlip.

void initPrintJobSettings()
{
PrintJobSettings printJobSettings;
;
printJobSettings =
new PrintJobSettings(printerSettingsFormletter);
// set the output format of the packing slip to PDF
printJobSettings.preferredMailFormat(PrintFormat::PDF);
// set the mail recipient (this could be parameterised,
// in the example it is hardcoded)
if (purchTable)
printJobSettings.mailTo(“foo@hotmail.com")
// set the mail subject if (purchTable)
printJobSettings.mailSubject(‘@SYS72882’
+ “ “ + purchTable.PurchId);
this.updatePrinterSettingsFormLetter(
printJobSettings.packPrintJobSettings());
}

Add a new method in the class PurchFormLetter.


void initPrintJobSettings()
{
}

Call the method in the main method of the class PurchFormLetter.


{

purchFormLetter.parmId(parmId);
purchFormLetter.transDate(systemDateGet());
purchFormLetter.initPrintJobSettings();
if (purchFormLetter.prompt())
{

}

Comments 4 comments
Skaue said...

Anyone tested this on AX 2009? At first glance I can't see why it shouldn't work.

Zubair Ahmed said...

Nice post.

Visit my site Dynamics AX at daxline.blogspot.com

If you like it add to your links and I'll do the same.

Patrik Luca said...

I've added Zubair's Microsoft Dynamics AX blog to my blog list.

santosh singh said...

Your all posts are nice. This is another blog which i get very useful for dynamics learner
http://daynamicsaxaptatutorials.blogspot.com/

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Live Traffic Feed

Recent Visitors

Blog Archive

My Blog List

Followers

Guest Links