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, ...
Answered

need to change parameter(To email) of SRS print destination

(0) ShareShare
ReportReport
Posted on by 255

hello expert,

I'm trying to dynamically change the email's to address at print management setup when generating a purchase order confirmation report using print management.

6087.email.png

email1.png

I have the same question (0)
  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Akshay,

    Check PurchPurcahseOrderController.initFormLetterReport method. You can try to override print management settings in the same way: construct your own SRSPrintDestinationSettings and add them to formLetterReport.

  • Akshay Thombare Profile Picture
    255 on at
    [quote user="Sergei Minozhenko"]

    Hi Akshay,

    Check PurchPurcahseOrderController.initFormLetterReport method. You can try to override print management settings in the same way: construct your own SRSPrintDestinationSettings and add them to formLetterReport.

    [/quote]

    Is it the right way?If yes then do you mean that i need to add this code in formletterreport class?

    SrsReportRunController controller = new SrsReportRunController();
    SRSPrintDestinationSettings printSettings;
    SrsReportEMailDataContract emailContract;
    controller.parmReportName(ssrsReportStr(PurchPurchaseOrder,Report));
    emailContract = new SrsReportEMailDataContract(); // create email contract

    // fill in the email contract details
    emailContract.parmAttachmentFileFormat(SRSReportFileFormat::PDF);
    emailContract.parmSubject("Purchase Order Confirmation");
    emailContract.parmTo("cmummadi@godrej.com");

    // get print settings from contract
    printSettings = controller.parmReportContract().parmPrintSettings();

    // update print settings with email contract and use pdf format in the attachment
    printSettings.printMediumType(SRSPrintMediumType::Email);
    printSettings.parmEMailContract(emailContract);
    printSettings.fileFormat(SRSReportFileFormat::PDF);

    // suppress the parameter dialog
    controller.parmShowDialog(false);

    // start operation
    controller.startOperation();

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Akshay,

    I would go with CoC approach for PurchPurcahseOrderController.initFormLetterReport and added code after the next statement, similar to

    formLetterReport.parmDefaultCopyPrintJobSettings(new SRSPrintDestinationSettings(purchPurchOrderJournalPrint.parmPrinterSettingsFormLetterCopy())); //Create own print settings
    formLetterReport.parmDefaultOriginalPrintJobSettings(new SRSPrintDestinationSettings(purchPurchOrderJournalPrint.parmPrinterSettingsFormLetter())); //Create own print settings

  • Akshay Thombare Profile Picture
    255 on at

    I'm facing this error

    Function PurchTableAllVersions.initFromProformaPurchTableVersion has been incorrectly called.

  • Akshay Thombare Profile Picture
    255 on at

    Here is my code

    [ExtensionOf(classstr(PurchPurchaseOrderController))]

    final class PurchPurchaseOrderController_Extension

    {

       protected void initFormLetterReport()

       {

           next initFormLetterReport();

           if (printCopyOriginal == PrintCopyOriginal::OriginalPrint)

           {

               formLetterReport.cfssrsprintdestinationsetting();

           }

       }

    }

    [ExtensionOf(classstr(FormLetterReport))]

    final class FormLetterReport_Extension

    {

       public  void cfssrsprintdestinationsetting()

       {

           SrsReportRunController controller = new SrsReportRunController();

           SRSPrintDestinationSettings printSettings;

           SrsReportEMailDataContract emailContract;

           controller.parmReportName(ssrsReportStr(PurchPurchaseOrder, Report));

           emailContract = new SrsReportEMailDataContract(); // create email contract

           // fill in the email contract details

           emailContract.parmAttachmentFileFormat(SRSReportFileFormat::PDF);

           emailContract.parmSubject("Purchase Order Confirmation");

           emailContract.parmTo("cmummadi@cloudfronts.com");

           // get print settings from contract

           printSettings = controller.parmReportContract().parmPrintSettings();

           // update print settings with email contract and use pdf format in the attachment

           printSettings.printMediumType(SRSPrintMediumType::Email);

           printSettings.parmEMailContract(emailContract);

           printSettings.fileFormat(SRSReportFileFormat::PDF);

           // suppress the parameter dialog

           controller.parmShowDialog(false);

           // start operation

           controller.startOperation();

       }

    }

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi,

    Do not create a new controller class. Just modify existing print management settings. It should be something like this:

    [ExtensionOf(classstr(PurchPurchaseOrderController))]
    
    final class PurchPurchaseOrderController_Extension
    
    {
    
       protected void initFormLetterReport()
    
       {
    
           next initFormLetterReport();
    
           if (printCopyOriginal == PrintCopyOriginal::OriginalPrint)
    
           {
               SRSPrintDestinationSettings printSettings = formLetterReport.parmDefaultOriginalPrintJobSettings();
            
               // update print settings with email contract and use pdf format in the attachment
            
               printSettings.printMediumType(SRSPrintMediumType::Email);
            
               printSettings.parmEMailContract(emailContract);
            
               printSettings.fileFormat(SRSReportFileFormat::PDF);
    
           }
    
       }
    
    }

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Are you sure that you need a customisation here ? Out of the box you can use email tokens, for example, @Invoice@ will send email to a customer's email with type invoice, this way you can use contact details specified on a customer record. Here is a blog that talks about this functionality cloudblogs.microsoft.com/.../

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 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans