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

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.


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
// set the mail recipient (this could be parameterised,
// in the example it is hardcoded)
if (purchTable)
// set the mail subject if (purchTable)
+ “ “ + purchTable.PurchId);

Add a new method in the class PurchFormLetter.

void initPrintJobSettings()

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


if (purchFormLetter.prompt())


Continue reading......

by Patrik Luca 3 comments

03 June 2011

Update planned order upon modified salesline

Business requirement: update planned order
upon modification of a salesline
without master scheduling

Sometimes you want to see changes made on a SalesLine immediately on the
reference Planned Order, without Master Scheduling. This post describes
how you can make a little code adaptation to achieve this. The changed planned
order belongs to the dynamic master plan, which seems most logic in
these cases.

Solution: X++ code to be added

Add following method to the class SalesLineType and call it in the update
method of the class SalesLineType.

void synchPO (SalesLine _salesLine) 
    ReqPO reqPO;

    reqPO = ReqPO::find(ReqPlanSched::defaultDynamicId(),

if (reqPO)
// whatever field in reqPO to be updated based on
// some information on the referenced SalesLine
reqPO.Qty = _salesLine.SalesQty;
if (reqPO.validateWrite()

Continue reading......

by Patrik Luca 1 comments

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


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.

Blog Archive

My Blog List