Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / SalesPackingSlip repor...
Finance forum
Answered

SalesPackingSlip report design not updated

Posted on by 674

Hi All,

I would like to change the SalesPackingSlip report design a bit and thus in order to expand application suite report data set, I duplicated the existing report and changed the design and created the extension of a menu item and assign the extension of controller to it. 

my code is as follows. 

 

class SalesPackingSlipController_my extends SalesPackingSlipController
{

    public static SalesPackingSlipController_my construct()
    {
        #ISOCountryRegionCodes
        GlobalizationInstrumentationHelper::featureRunByCountryRegionCodes(
                    [ [#isoIT, GlobalizationConstants::FeatureReferenceIT00020] ],
                    funcName()
                );

        return new SalesPackingSlipController_my();
    }

    /// 
    /// Initailzes the controller, sets the print management, assigns parameter values and runs the SRS report.
    /// 
    /// 
    /// The Args object.
    /// 
    public static void main(Args _args)
    {
        SrsReportRunController      formLetterController = SalesPackingSlipController_my::construct();

        // 
        // print document set
        if (TaxThaiGovCertificationFeatureChecker::isUnrealizedVATEnabled()
            && _args.parmEnum() != PrintCopyOriginal::OriginalPrint)
        {
            SalesPackingSlipController::printDocumentSet(_args);
        }
        else
        {
            // 
            SalesPackingSlipController_my controller = formLetterController;
            controller.initArgs(_args, PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderPackingSlip).getDefaultReportFormat());
            
            // redirect to my own report, SalePackingSlip_my 
            if (controller.reportName == ssrsReportStr(SalesPackingSlip, Report))
            {
                controller.parmReportName((ssrsReportStr(SalesPackingSlip_my, Report)));
            }

            if (classIdGet(_args.caller()) == classNum(SalesPackingSlipJournalPrint))
            {
                SalesPackingSlipController::subscribeToRenderingCompleted(formLetterController);
            }

            formLetterController.startOperation();
            // 
        }
        // 
    }

}

However, the report design is not updated at all.  I guess the report design is overwritten after calling formLetterController.startOperation();

Where should I modify to redirect it to my own report?

Thank you. 

  • ShawnDEV Profile Picture
    ShawnDEV 674 on at
    RE: SalesPackingSlip report design not updated

    Hi,

    I just did the full build of all models (not only my model), then it shows correctly :)

    Thank you.

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,417 on at
    RE: SalesPackingSlip report design not updated

    Rather than change the format, you can delete the print management settings and check if it works? I am not sure if you have included code to add the design to print management.

  • ShawnDEV Profile Picture
    ShawnDEV 674 on at
    RE: SalesPackingSlip report design not updated

    Hi,

    I did full build of my my model, data sync. and re-deployed the report. but there were no errors but still the original report design is shown.

    Should I change this report format ? Is this the only option?

    pastedimage1616538801484v1.png

    Thank you. 

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,417 on at
    RE: SalesPackingSlip report design not updated

    Hi Shawn,

    If it is showing the right report name, it should print the correct report. Could you please try re-deploying the report and see if works? Please check if there are any errors while deploying as well that might be preventing the changes being deployed.

  • ShawnDEV Profile Picture
    ShawnDEV 674 on at
    RE: SalesPackingSlip report design not updated

    Hi,

    I did that but still the updated report design is not shown but the original one only although the report has been deployed without any error.

    and also when I click preview/print - copy preview menu item it shows the progress bar with the correct report name like 'Processing operation - SalesPackingSlip_my.Report'. I am not sure what went wrong..

    Is there somewhere I need to check additionally?

    Thank you.

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,417 on at
    RE: SalesPackingSlip report design not updated

    Hi Shawn,

    If you only have a change in design, I don't think you need to create a child class of the controller to achieve this. You can create a CoC on

    getDefaultReportFormat method in PrintMgmtDelegatesHandler class and return this report for sales packing slip

    [ExtensionOf(classstr(PrintMgmtDelegatesHandler))]
    final class PrintMgmtDelegatesHandler_myExtension
    {   
        
        protected static PrintMgmtReportFormatName getDefaultReportFormat(PrintMgmtDocumentType _docType)
        {
            PrintMgmtReportFormatName reportFormatName;
        
            reportFormatName = next getDefaultReportFormat(_docType);
            
            if (reportFormatName == ssrsReportStr(SalesPackingSlip, Report))
            {
                return ssrsReportStr(SalesPackingSlip_my, Report);
            }
        }
    }

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,995 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,610 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans