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, ...
Suggested answer

file name change for Invoice reports

(3) ShareShare
ReportReport
Posted on by 809
Hi All,
 
As per the requirement, I did the below code to change the file name for Sales Invoice and I able to download the file with the name. for example - InvoiceId
 
[ExtensionOf(classStr(SrsReportRunController))]
final class UCL_SrsReportRunController_Extension
{
    public CustInvoiceJour  custInvoiceJour; 
    
    public LabelType parmDialogCaption(LabelType _dialogCaption)
    {
        reportDialogCaption = next parmDialogCaption(_dialogCaption);

        if (this.getReportContract().parmRdpName() == 'SalesInvoiceDP')
        {
            args = this.parmArgs();
            custInvoiceJour = args.record();

            if (custInvoiceJour)
            {
                reportDialogCaption = strFmt('%1', custInvoiceJour.InvoiceId); 
            }
        }
        return reportDialogCaption;
    }

}
It's perfectly working for Sales Invoice.
 
In the similar way, I do for Free Text Invoice.

Account Receivable -- Invoices -- All Free Text Invoices 

Then user can select any posted invoice, Then View - Copy or Original.
 
In this scenario, I also looking for the change the file name with Invoice Id but it's not worked and download with "Show copy" as standard.
 
I did the below code for Free Text Invoice
 
[ExtensionOf(classStr(SrsReportRunController))]
final class UCL_FreeTextInvoice_Extension
{
    public CustInvoiceJour  custInvoiceJour; 
    public CustInvoiceTable custInvTable;
    
    public LabelType parmDialogCaption(LabelType _dialogCaption)
    {
        reportDialogCaption = next parmDialogCaption(_dialogCaption);
        
        if (this.getReportContract().parmRdpName() == 'FreeTextInvoiceDP')
        {
            args = this.parmArgs();   
         
            //custInvoiceJour = args.record();

            custInvTable = args.record();

                       
            if (custInvTable) // If the free text invoice print from All free text invoice
            {
                reportDialogCaption = strFmt('%1', custInvTable.displayInvoiceAccount()); 
            }
        }
        return reportDialogCaption;
    }

}
Kindly let me know why I am not getting the buffer of CustInvoiceTable. I debugged that, It skip the if condition.
Is anything wrong in the code?
 
Kindly suggest please. Thanks in advance!
Categories:
I have the same question (0)
  • CU05031448-0 Profile Picture
    809 on at
    file name change for Invoice reports
    Can anyone provide insight on this pls.
     
    Thanks in advance
  • Suggested answer
    Saalim Ansari Profile Picture
    648 on at
    file name change for Invoice reports
    Hi, 
     

    When launching Sales Invoice, the record (CustInvoiceJour) is passed correctly via Args.record().

    But when launching Free Text Invoice, the system may not pass the CustInvoiceTable as Args.record(). Instead, it's sometimes empty or uses different mechanisms to pass data (like Report Parameters).

  • Suggested answer
    Navneeth Nagrajan Profile Picture
    2,191 Super User 2025 Season 2 on at
    file name change for Invoice reports
    Hi Cu05031448-01,
     
    After checking the standard report FreeTextInvoice standard report, the custInvoiceTable buffer is initiated based on the custInvoiceJour. Check out this code under the runPrintMgmt() method. 
     
     
    Would recommend you extend the standard class FreeTextInvoiceController class instead of extending the SrsReportRunController. Provides you more flexibility where most of the data can be fetched using custinvoiceTable and custInvoiceJour table buffer. Hope this helps.
     
    Happy to answer questions, if any.
     
     

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 813

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 566 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans