AX 2009, AX 2012, Development, dialog, Dynamics AX, User parameters, without dialogable class, without runbasebatch

Quick Dialog to take user entered parameters without dilaogable class creation

Following job uses dialog class to take parameters from user and run the job

static void UserParamSample(Args _args)

wmslocationID     wmslocationID;

str                           palletstoRAF;

dialog          dlg = new dialog();

 dialogField     dlgPalletIDs,dlgwmslocation;

 dlgPalletIDs = dlg.addField(typeid(ItemFreeTxt),”Container number”,”Enter pallet Ids seperated by commas”);
dlgwmslocation = dlg.addField(typeid(wmslocationid),”Location”);





palletstoRAF = dlgPalletIDs.value();

wmslocationid = dlgwmslocation.value();

//Run the Job



AX 2009, AX 2012, Development, Dynamics AX, Uncategorized

How to send a file to the printer in dynamics AX

How to send a file to the printer in dynamics AX

Following Job demonstrates on how to send a file from the file system to the locally connected printer( printer physically can be network or local but it should be added to the client and its name should be visible in the control panel–> devices and printers)

static void sendToPrinter(Args _args)
PrintJobSettings printJobSettings = new PrintJobSettings();
Dialog dialog = new Dialog();
DialogField dialogFileName;
str CoreLabelExe;
str CoreLabelParm;
// initiallize printer with the printer name. This initiallization automatically
// gets dll file details and port details.
printJobSettings = new PrintJobSettings();
printJobSettings.deviceName(‘Microsoft XPS Document Writer’);
dialogFilename = dialog.addField(typeid(FilenameOpen));
if (
// finding executable DLL
CoreLabelExe = WinAPI::findExecutable(dialogFileName.value());
// Create Shell command parameter
CoreLabelParm = strFmt(‘ /PT “%1” “%2” “%3” “%4″‘,
// run dll on the shel with parameter
winAPI::shellExecute(CoreLabelExe, CoreLabelParm);