Find print job settings specified on a Customer for Reports

Hi Friends,
Recently I came across a requirement where in I had to print AX 2012 collection letter report in PDF format and attach it to a mail Item and send it across to the customer. The requirement here was that this functionality has to be triggered on a click of button which was pretty normal but the real catch here was that the email ID should be fetched from the customers print job settings and not a normal setup, In standard system these settings can vary according to journals. I did some research and found out a way to find print job settings of customer for  collection letter journal Report. Here is the code, you can use this code for finding print job settings of many important system reports such as Invoice etc….

Static void findPrintJobSettings(Args _args)

{

FormLetterReport formletterReport;

PrintMgmtPrintSettingDetail settingDetail;

SRSPrintDestinationSettings destination;

CustCollectionLetterJour    jour;

CustTable                   custTable;

select jour where jour.RecId    ==  11290923078;

select custTable  where custTable.AccountNum == “2014”;

formLetterReport = FormLetterReport::Construct(PrintMgmtDocumentType::

                                                                                     CustCollectionLetter);

formLetterReport.parmPrintType(PrintCopyOriginal::OriginalPrint);

formLetterReport.loadPrintSettings(jour,custTable,

                                                              jour.LanguageId,

 

                                                             jour.CollectionLetterNum);

 

    while(formletterReport.moveNextPrintSetting())

 

    {

 

        settingDetail   =   FormLetterReport.getCurrentPrintSetting();

destination =   settingDetail.parmPrintJobSettings();

print destination.printMediumType();

print destination.emailTo();

print destination.numberOfCopies();

pause;

     }

 

}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s