Skip to main content

Posts

Get Position and Department of an employee | AX 2012

A simple job to get position/designation and department of an employee using employee id: static void WorkerPositionDepartment(Args _args) {     HcmWorker                       hcmWorker;     HcmPositionWorkerAssignment     hcmPositionWorkerAssignment;     OMOperatingUnit                 oMOperatingUnit;     HcmPositionDetail               hcmPositionDetail;     HcmJob                          hcmJob;     HcmPosition             ...

Run SSRS report using x++ code | AX 2012

This post describes how to run an SSRS report through x++ code and passing report parameters as well. Its a simple code and comments are added for further ease in code understanding! public static void runSSRSReport() {     SrsReportRunController controller;             controller = new SrsReportRunController();     controller.parmLoadFromSysLastValue(false);      // write report name and its design in quotes that you want to run     controller.parmReportName("ReportName.DesignName");      // set additional, optional properties like setting landscape to true     controller.parmReportContract().parmPrintSettings().landscape(true);          // set print destination screen/printer/file etc.     controller.parmReportContract().parmPrintSettings().printMediumType (SRSPrintMediumType::S...

Catching a key stroke in AX 2012

Courtesy: http://www.doens.be/2010/03/catching-a-key-press/ When you want to catch a key-stroke on a form, you can override the method task() The default method will look like this: public int task ( int _taskId ) { int ret; ret = super ( _taskId ) ; // write you're code here return ret; } Now you just need to check the _taskId , to know witch key you have stroke. You can compare this withe the values from the Task-macro. // Task-ID values, to be used with formControl's // return value from the method task() //--------------------------------------------------------   #define. taskF1 ( 257 ) #define. taskCtrlQ ( 264 ) #define. taskEnter ( 288 ) #define. taskShiftEnter ( 307 ) #define. taskNew ( 260 ) #define. taskSave ( 272 )   #define. taskShortCutMenuKey ( 519 ) #define. taskAlt ( 520 )   #define. taskCut ( 770 ) #define. taskCopy ( 771 ) #define. taskPaste ( 772 )   #define. taskDeleteKey ( 773 ) #define. tas...

Barcode printing and scanning ax 2012 | Useful links & material

I came across client's requirement to integrate barcode scanner and printer with AX in their production process. So inventory in (pick list generation) was done using barcode scanner, and at the end of each process (RAF journal) production sticker is generated with Item id and its batch number. First of all, le tme tell you that barcode scanner is just like an external keyboard attached to system, its drive gets auto-installed in windows (I tried on windows 7). As soon as driver gets installed yoou can test the scanner by opening a notepad and scanning some barcode, which will input contained information on notepad. Same would be the case in AX. You just need to place cursor on a field and scan the barcode. No integration tool required whatsoever. So it's pretty simple and easy. I used custom code to generate code39 barcode, and added a table field (with EDT barcodeStr) to save barcode string having item and batch number separated by % symbol, so I might be able to parse ...