Tuesday, September 29, 2015

Changing report design via code SSRS

It is one of the normal development requirements you may came across where you want to change the report design name on the basis of some logic. The following example shows you how to achieve this.

The modification is done in Controller class "outputReport" method, before "super" call you need to set the updated design name based on some condition and its done.

/// <summary>
///    Executes the report for the print management setting that is currently loaded.
/// </summary>
/// <remarks>
///    The <c>outReports</c> method loops over print management settings and calls this method for each
///    print management setting loaded.
/// </remarks>
/// <exception cref="M:Exception::Error">
///    The print management object has not been initialized.
/// </exception>
public void outputReport()
{
    reportDesign = 'MyReport.Report_DesignA';
    this.parmReportName(reportDesign);
    this.parmReportContract().parmReportName(reportDesign);
    formLetterReport.parmReportRun().settingDetail().parmReportFormatName(reportDesign);
    super();
}

Tuesday, September 22, 2015

Restoring missing DirPartyLocation info

I came into issue on one of the environment where somehow records of Vendor Contacts data was deleted from DirPartyLocation table and we need to restore the data without backup database as the backup database was way old to recover.

By looking into GAB framework which was introduced in AX 2012, I come to know that DirPartyTable  maintains Primary contacts and address information in the following fields.

  • PrimaryAddressLocation
  • PrimaryContactEmail
  • PrimaryContactFax
  • PrimaryContactPhone
  • PrimaryContactTelex
  • PrimaryContactURL