Skip to main content

Notifications

Announcements

No record found.

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 752

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.

  • Rhushikesh R Profile Picture
    Rhushikesh R 752 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.

  • István Orosz Profile Picture
    István Orosz 2,137 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.

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 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);
    }

  • Rhushikesh R Profile Picture
    Rhushikesh R 752 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.

  • István Orosz Profile Picture
    István Orosz 2,137 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
    Rhushikesh R 752 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?

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans