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

How to change email subject in recurring batch at each run?

(0) ShareShare
ReportReport
Posted on by

Hi, I have setup a batch job to run a report and send it in excel format recurrently every morning. Now a user has requested to include the date in the subject of that email that is being sent through batch every day. Below is a part of the code in my controller class of the report

myDateTime = DateTimeUtil::getSystemDateTime();
myDateTime = DateTimeUtil::applyTimeZoneOffset(myDateTime,DateTimeUtil::getUserPreferredTimeZone());

contract = myController.parmReportContract().parmRdpContract() as MyContract;
printSettings = myController.parmReportContract().parmPrintSettings();
emailSubject = strFmt("My email subject - %1", myDateTime);
printSettings.emailSubject(emailSubject);
myController.parmReportContract().parmPrintSettings(printSettings);
myController.parmReportContract().parmRdpContract(contract);

myController.startOperation();

But it uses same date time in subject every day. Meaning, the date time is not getting updated each run. Because controller is called just once when setting up the recurring batch. I will really appreciate any suggestions on where should I make changes to update the subject line on each batch run.

Thank you!

GJ

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: How to change email subject in recurring batch at each run?

    Look at outputReports method of SrsPrintMgmtController class, there you have access to print management settings and should be able to change email subject for each report run.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans