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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Open 2 Sales Invoice report copies in single click with different customized title in AX2012

(0) ShareShare
ReportReport
Posted on by

Hi Everyone,

When we click on Original Preview button of Sales Order Invoice the Sales Invoice Report gets opened.

But my client wants that when user clicks on original preview, 2 copies should get open with 2 different custom title as "Customer Copy" and "Original copy".

Rest of the design remains same as original one.

How can I achieve the requirement in shortest possible way? Please help.

  • Gunjan Bhattachayya Profile Picture
    on at
    RE: Open 2 Sales Invoice report copies in single click with different customized title in AX2012

    Hi Rhushikesh,

    You can create a custom class and call two reports using "menufunction" from the main method of the class. Create an action menu item for the class and replace the existing original preview button with this menu item.

  • Rhushikesh R Profile Picture
    on at
    RE: Open 2 Sales Invoice report copies in single click with different customized title in AX2012

    Hi Gunjan, in this case my new controller class should be exact replica of existing controller class SalesInvoiceController or what?

  • István Orosz Profile Picture
    on at
    RE: Open 2 Sales Invoice report copies in single click with different customized title in AX2012

    Hi Rhusikesh,

    If the two different custom title as "Customer Copy" and "Original copy" should be on the report title and not on the form, it is better to give them as parameter. If the client changes his mind, you do not have to rebuild and redeploy the whole report, just change the parameters.

    Controller class can be copied, if you choose that solution, just be aware that printDocumentSet() method has an extra line for the report name: 

    reportName = ssrsReportStr(SalesInvoice, ReportTH);

    If you want to use the same report layout, it can remain the same.

  • Rhushikesh R Profile Picture
    on at
    RE: Open 2 Sales Invoice report copies in single click with different customized title in AX2012

    Hi Istvan, actually I need to store the Customer Copy and Original copy in one customized parameter. But not sure how should I set the parameter conditionally.

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    on at
    RE: Open 2 Sales Invoice report copies in single click with different customized title in AX2012

    Hi Rhushikesh,

    There are two aspects to changes -

    1. You need to set the report header as "Customer copy' for one of the reports. You might need to create a new menuitem for that and handle the change in the SalesInvoiceController class.

    2. You create a new class for printing two reports one after the other. Maybe something like this -

    class printSalesInvoiceCopy
    {
    
    }
    
    static void main(Args _args)
    {
        new MenuFunction(menuItemOutputStr(SalesInvoiceCustCopy), MenuItemType::Output).run(_args);
        new MenuFunction(menuItemOutputStr(SalesInvoiceOriginal), MenuItemType::Output).run(_args);
    }

  • István Orosz Profile Picture
    on at
    RE: Open 2 Sales Invoice report copies in single click with different customized title in AX2012

    Hi Rhusikesh,

    You can store the text and pass it to the report layout in a hidden parameter, you have to set it in Visual Studio.

  • Rhushikesh R Profile Picture
    on at
    RE: Open 2 Sales Invoice report copies in single click with different customized title in AX2012

    Thanks Gunjan. I went with the approach of calling the menu item twice. And as of now that works for me.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans