Skip to main content

Posts

Showing posts from December, 2014

Debug/Test SSRS report in AX 2012

People came across issues like report is not showing data on report or data is not per their expectation. It is really hard to judge where it goes wrong and what needs to be correct in which class RDP, Contract, UI or Controller. Following sample job can be used to debug SSRS report processing data and lead to find what goes unexpected. For more information about classes and table used in this example please read my previous post static void FF_ReportDPTest(Args _args) {     // temp table declaration     FF_ReportTmpTable       ffReportTmp;     // RDP class binded with FF_Report     FF_ReportDP             dataProvider = new FF_ReportDP();     // Contract class for report parameters     FF_ReportContract       contract = new FF_ReportContract(); ...

Run SSRS report from AX form

Continue from my previous post where I developed an example using all SSRS framework classes. One of them is controller class which is used to call SRS report from AX forms. Just for the note controller class is used for following purposes. Modifying a report query based on the input data Modifying report contract data based on the input data Control a report parameters dialog Open different reports/designs from the same menu item based on the input data Reports that are opened from a form Example; how to call report from AX form button/menuitembutton click void clicked() {     CustOpenInvoices        custOpenInvoicesLocal;     SrsReportRunController  controller = new FF_ReportController();     SrsReportDataContract   contract;     FF_ReportContract       rdpContractClass;   ...

Customise code tagging in AX 2012 – MS Dynamics AX Best practice

Code commenting is one of the best practice for any software development which really helps other team mates or future developers to understand code quickly. Code comments should be enough expounding for others. MS Dynamics AX provides diverse possibilities to comment out code in much better and generic way through scripts. This can be used by right click in any method within AOT objects as shown; Here we also have tagging option to use generic way to comment out our code and this could be really helpful when working on big projects. MS Dynamics AX uses a class EditorScript behind these scripts tool, I added a following method under this class for specific code comment pattern. public void tagging_CodeModifications(Editor editor) {     #Define.NextLine( '\n' )     int currentLineNo = editor.selectionStartLine();     int currentCol    = editor.selectionStartCol();   ...

Business/Working days in AX

Following job is to calculate business days/working days in AX using base calendars. In my case base calendar name is "24/5" you can change it as per your setup. static void businessdaysInPeriod(Args _args) {     WorkCalendarSched workCalendarSched;     date start;     date end;     counter workingdays;     counter totaldays;     CalendarId primCalendar= "24/5" ;     ;     start = str2date ( "21-11-2014" , 123 );     end   = str2Date ( "26-11-2015" , 123 );     workCalendarSched = new workCalendarSched();     while (start<=end)     {         totaldays++;         if (workCalendarSched.isdateopen(primCalendar,start)== true )         {  ...

Stop deletion of record from a table

Recently came across an issue where records from customized tables were being deleted occasionally. Following wat did a quick fix for me to stop further records delete from table.  Overwrite delete method on table and comment super(). This also stops deletion from code, e.g. if we write query delete_from table this commented super will prevent user to delete record from table. public void delete() {     //super(); } This will also stop deletion from code too. e.g. It worked fine but records can also be deleted by pressing Ctrl+F9 on table browser. To handle this situation I overwrite validateDelete method on table and returned False from there. public boolean validateDelete() {     boolean ret;     ret = super ();     return false ; }

Send email from AX using live or gmail exchange server

You may find few more posts over this topic to send emails from AX using live (Hotmail) or gmail exchange server. This is really helpful when we don’t have exchange is in place sometimes due to high cost or you just want to send emails for testing or demo purpose. Let’s see what parameters need to setup and how can we achieve this requirement. Go to System Administration | Setup | System | E-mail parameters P.S. I am using a dedicated email account at outlook (Hotmail) domain for this example. NTLM option can also be used; TechNet article is more helpful to get more information on these parameters. Here is the job I wrote to send email for selected user. I name it SendTextMail as in my following post I will be writing to send invitation from AX using Hotmail or Gmail exchange server. //SmtpSSL static void SendTextMail(Args _args) {     System.Net.Mail.MailMessage             mai...