Reading Infologs and Inserting new line for email body Dynamics ax 2012

I have designed a feature where i need to send the executions logs of Batch on its completion via email, That part is done perfectly fine and emails starts coming, I have read the infologs and concatenate the two strings so i can make one big string of multiple infologs, i was using \n between two strings but when i call the email sending code and pass the string; The new lines are not coming to email. The format for sending email was HTML.

i came to know that for HTML format. White spaces such as line-breaks are suppressed in HTML; and we have to use tags like <p> or <br />.

I have also pasted sample code on how i am reading the infologs and added <br/> tag for line break.


 private str 5000 readInfoLog()  
 {  
   SysInfologEnumerator enumerator;  
   SysInfologMessageStruct msgStruct;  
   Exception exception;  
   str 5000 Message;  
   enumerator = SysInfologEnumerator::newData(infolog.copy(1,infologLine()));  
   while (enumerator.moveNext())  
   {  
   msgStruct = new SysInfologMessageStruct(enumerator.currentMessage());  
   exception = enumerator.currentException();  
   message = message + strFmt("Type: %1; Message: %2",  
   exception,  
   msgStruct.message()) + '<br /> ';  
   }  
   return Message;  
 }  

Thanks
Happy Daxing

Playing with SSRS report in dynamics ax 2012

here is the simple code that i have created to print the SSRS report in dynamics ax 2012 from different scenarios.

How to print the SSRS report in dynamics ax 2012 from code.

    SrsReportRun srsReportRun;

    // initiate the report.
    srsReportRun = new SrsReportRun ("InventTruckTransactionReport.PrecisionDesign1");
    srsReportRun.init();
    srsReportRun.reportCaption("InventTruckTransactionReport.PrecisionDesign1");
    // set parameters name, value.
    srsReportRun.reportParameter("TruckTransDS_JournalId").value("000161_070");
    // suppress the dialog
    srsReportRun.showDialog(false);

    if( srsReportRun )
    {
        // run the report 
        srsReportRun.executeReport();
    }

How to save the SSRS report to PDF/HTML through code in dynamics ax 2012.

    SrsReportRun srsReportRun;

    srsReportRun = new SrsReportRun("InventTruckTransactionReport.PrecisionDesign1");

    srsReportRun.init();
    srsReportRun.reportCaption("InventTruckTransactionReport.PrecisionDesign1");
    srsReportRun.reportParameter("TruckTransDS_JournalId").value("000161_070");
    srsReportRun.showDialog(false);

    // Print to a file named ReportExample in HTML/PDF format.
    srsReportRun.printDestinationSettings().printMediumType(SRSPrintMediumType::File);
    srsReportRun.printDestinationSettings().fileFormat(SRSReportFileFormat::PDF);
    srsReportRun.printDestinationSettings().overwriteFile(true);
    srsReportRun.printDestinationSettings().fileName(@"C:\InventTruckTransactionReport.pdf");

    if( srsReportRun )
    {
        srsReportRun.executeReport();
    }
%d bloggers like this: