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 :
Microsoft Dynamics AX (Archived)

Customise SRSPrintDestinationSettings to keep a draft email instead of mailing it

(0) ShareShare
ReportReport
Posted on by 506

I need to do a development that will allow the P.O. "Pro-forma confirmation" to be saved as a draft email instead of being sent. I have put in a crude hack to test I can do this and I can make the email save without sending and it pops up ready to send. It's just a case of driving this process by settings.

However, given that email settings are held in SRSPrintDestinationSettings, I believe this class would need to be customised so that automatic email sending can continue to be functional / supported for any other trade documents.

e.g. Ideally I would like to have a "Save as draft" checkbox under the Image file format below.

Can anyone offer advice about how best to do this?

 printdest.png

*This post is locked for comments

I have the same question (0)
  • _MGP Profile Picture
    506 on at

    Thanks for the reply Crispin.

    I think my original question maybe is not totally clear so apologies for that.

    I think what I need to do is extend the existing email settings rather than create a completely new setting (i.e. an additional checkbox within the existing email settings - so I don't think I need to add to the Enum SRSPrintMediumType?)

    It is good to know about those methods so thanks for the pointers.

    My question should have been more towards where I need to make the changes to support the new setting for generating draft emails for all other trade documents. I couldn't find anything where others have done a similar thing but I will try to pick apart and post back when I get there.

  • Verified answer
    _MGP Profile Picture
    506 on at

    Just to update the thread after I got this working recently.

    1. Within form SRSPrintDestinationSettingsForm, Create checkbox (MailSaveAsDraft) under the TabPage MailTab ensure AutoDeclaration set to Yes
    2. As per Crispin, modify SRSPrintDestinationSettingsFormmethods (his Step (2))
      • in form init(), call mailSaveAsDraft.value(printSettings.emailIsDraft());
      • in form closeOK(), call printSettings.emailIsDraft(mailSaveAsDraft.checked());
    3. Modify SrsReportEMailDataContract
      • add new member, boolean saveAsDraft;
      • add new parm method, parmSaveAsDraft().
    4. Modify SrsPrintDestinationSettings
      • a new boolean member emailIsDraft that is also defined in the packed list within the class declaration
      • a new parm method, emailIsDraft, that supports this member
      • modify existing method, parmEMailContract, calling emailContract.parmSaveAsDraft(this.emailIsDraft());, to supply the new data when the report is run.
    5. Modify SrsReportRunMailer
      • modify emailReport() method to supply _emailContract.parmSaveAsDraft() as the parameter value for showDialog instead of the hard-coded false when calling inetMailer.sendMailAttach().
    6. Modify SrsReportRunPrinter
      • modify toEmail() method as follows

    if(!emailContract.parmSaveAsDraft())
    {
        // The report has been successfully sent as attachment to email.
        info("@SYS344685");
    }
    else
    {
        // The report has been successfully saved as attachment to draft email.
        info("@NEW123");
    }


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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans