web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Print management for new SSRS report

(0) ShareShare
ReportReport
Posted on by

Hi ,

I need to develop a new report for an existing one .

Report : customer account statement
Customized report : VIK_CustaccoutnstatementExt   2 design , Report and report2

I have duplicated the design and made the changes, This report has 2 design which will get called based on some parameter .

What i would like to understand is how does the report needs to called from the controller class.

Do we need to add anything in the class "PrintMgmtReportFormatPopulator" -> "add documents" method.and add both the report design.

OR we just need to add in the class "PrintMgmtReportFormatPopulator"

case PrintMgmtDocumentType::Ciustome statement report:
                    _result.result(ssrsReportStr(VIK_CustaccoutnstatementExt , Report)); -> how do i add 2 design over here ?
                    break;
I want that my custom design to be called by default .
this 2 reports should show in the print management setup under form setup.

thanks,
VikPick
I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Vikas,

    We have this thread where the same requirement has already been discussed. You can check the code suggested there and let us know if you need anything else .

  • Community Member Profile Picture
    on at

    hi Gunjan,

    What if the report is not set in the print management setup.

    Also do we need to add it in

    "PrintMgmtReportFormatPopulator" -> "add documents" method.and add both the report design.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Vikas,

    Since you are using thee same document type i.e. PrintMgmtDocumentType::CustAccountStatement, you won't need to add any code in PrintMgmtReportFormatPopulator class. This class has an extension - PrintMgmtReportFormatPopulatorAppSuite_Extension. If you check the addSalesDocuments method, there is a statement to add the standard report for customer account statement -

    pastedimage1645616304532v1.png

    This in turn will get the default report name from getDefaultReportFormat method in PrintMgmtDocType class, for which you would already have created a CoC.

    Had this been a new document type altogether, you would have had to write code in the PrintMgmtReportFormatPopulator class. 

  • Community Member Profile Picture
    on at

    Hi Gunjan,

    Thanks for the quick reply.

    So in this case what all things i need to do.

    If I extend a controller class then I will have to change the menu item of the custAccountStatementExt and keep this contollerExt as the menu item for this report to run ? 

    class CustAccountStatementExtControllerExt extends CustAccountStatementExtController
    {
        public static CustAccountStatementExtControllerExt construct()
        {
            return new CustAccountStatementExtControllerExt();
        }
        
        public static void main(Args _args)
        {
            SrsReportRunController                  formLetterController = CustAccountStatementExtControllerExt::construct();
            CustAccountStatementExtControllerExt    controller = formLetterController;
            if(parameterA)
             {
            controller.parmReportName(ssrsReportStr(CustAccountStatementExtCopy, Report));
             }
            else
             {
            controller.parmReportName(ssrsReportStr(CustAccountStatementExtCopy, ReportB));
             }
    
            controller.parmArgs(_args);
            controller.startOperation();
        }
    }

    Do I need to create a COC method as well ? because I am going to write the code in PrintMgmtDelegatesHandler class 

     protected static PrintMgmtReportFormatName getDefaultReportFormat(PrintMgmtDocumentType _docType)
        {
            str ret;
            switch (_docType)
            {
                case PrintMgmtDocumentType::CustAccountStatement:
    if(parameterA)
    {   ret = ssrsReportStr(CustAccountStatementExtCopy,Report);
    }
    else
    {ret = ssrsReportStr(CustAccountStatementExtCopy,ReportB);
    }
            }
            ret = next getDefaultReportFormat(_docType);
            return ret;
        }


    So no changes will be required further.

    OR 
    Creating a record in print mgmt class as per abopve snippet itself is self sufficient to handle everything ....we dont even need to create an extension class or COC ?

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    You don't need to make any changes to the controller class. Change to the print PrintMgmtDelegatesHandler class only should be enough -

    protected static PrintMgmtReportFormatName getDefaultReportFormat(PrintMgmtDocumentType _docType)
    {
        str ret = next getDefaultReportFormat(_docType);;
        
        switch (_docType)
        {
            case PrintMgmtDocumentType::CustAccountStatement:
            if(parameterA)
            {   ret = ssrsReportStr(CustAccountStatementExtCopy,Report);
            }
            else
            {
                ret = ssrsReportStr(CustAccountStatementExtCopy,ReportB);
            }
    
        return ret;
    }

    The report design assignment should be after the next call since you are modifying standard functionality. You also have an if condition based on a parameter. I am not sure where you are fetching that from. You will also need to remove the design selected for customer account statement under Print management, in case you have the setting there.

  • Community Member Profile Picture
    on at

    Hey Gunjan

    You are really helping me a lot:) with my queries.

    One last question and I will make changes and mark it as complete

    So in case user selects any value in the print management will that override the code values or the code value will override the print management settings.

    thanks man

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Vikas,

    If there is a selection in Print management, it seems to override this code assignment( as per the comments in the other thread). I haven't had the chance to debug this myself and check. You could try this after you have made the code changes and see if the print management settings override the code changes.

  • Community Member Profile Picture
    on at

    yes will do that..

    I guess the Print management setting will overrise the code only if run with print management is mark to yes....however normally it shoudl take it from code...

    I will check and update here back

    thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans