static void job(Args _args)
{
CustInvoiceJour InvJTbl;
SalesId Id;
ReportRun report;
RecordSortedList List = new RecordSortedList(62);
SalesFormLetter_Invoice SalesFormLetter;
;
salesformletter = new SalesFormLetter_Invoice(false);
Id = "100000002";
Select InvJTbl Where InvJTbl.SalesId == Id;
List.ins(InvJTbl);
report = new ReportRun(new Args(ReportStr(SalesInvoice)));
report.args().caller(null);
report.args().object(List);
report.printJobSettings().setTarget(PrintMedium::File);
report.printJobSettings().format(PrintFormat::PDF);
report.printJobSettings().fileName("C:\\Temp\\Test.pdf");
report.run();
}
Check this out, it will help you:
http://www.axaptapedia.com/Printer_Settings_and_Run_From_Code
Remember to pack/unpack the printersettings at the end.
I would advise trying it with a simple report first (like cust), because the
reason it doesn't work is probably because you printersettings are
overwritten in the report itself.
See fetch() method of the salesInvoice report:
salesFormLetterReport.loadPrintSettings(...).
Here, your settings are overwritten with setup (I don't know where this is
set up...).
Hope this helps,
Best regards,
Klaas.
----------------
http://www.artofcreation.be
Hope this hepls you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
http://axwonders.blogspot.com/2011/02/save-microsoft-dynamics-ax-2009-report.html
This post will give you more specifics about how to create an email class and other things related to saving and sending a report in PDF through Outlook
http://axwonders.blogspot.com/2011/02/save-microsoft-dynamics-ax-2009-report_23.html
>> On Thursday, December 03, 2009 6:03 AM Klaas Deforche wrote:
>> Hi there,
>>
>> Check this out, it will help you:
>> http://www.axaptapedia.com/Printer_Settings_and_Run_From_Code
>> Remember to pack/unpack the printersettings at the end.
>>
>> I would advise trying it with a simple report first (like cust), because the
>> reason it does not work is probably because you printersettings are
>> overwritten in the report itself.
>> See fetch() method of the salesInvoice report:
>> salesFormLetterReport.loadPrintSettings(...).
>> Here, your settings are overwritten with setup (I do not know where this is
>> set up...).
>>
>> Hope this helps,
>> Best regards,
>> Klaas.
>> ----------------
>> http://www.artofcreation.be
>>
>>
>> "AgNi00" wrote:
>>> On Thursday, December 03, 2009 2:23 PM Axel Kühn wrote:
>>> Hi,
>>> please take a look at an article i wrote about how to post and print
>>> salesorders with x++.
>>> In the article you can find an example on how you can print a confirmation
>>> to pdf.
>>>
>>> http://translate.google.com/translate?client=tmpg&hl=de&u=http%3A%2F%2Fblog.ak-home.net%2FPermaLink%2Cguid%2C5cb22557-acb4-41ec-9546-c65d681e3a3d.aspx&langpair=de|en
>>>
>>> Hope this hepls you.
>>> --
>>> Sincerely yours
>>> Axel K??hn (visit my Dynamics AX blog at: http://blog.ak-home.net)
>>>
>>>
>>> "AgNi00" wrote:
>>>> On Friday, December 04, 2009 2:39 AM AgNi00 wrote:
>>>> Thanks for helping me out here. It was correct that my code was overwritten
>>>> in the fetchmethod. I moved my printersettings to fetch and now it works just
>>>> fine.
>>>>
>>>>
>>>> "Klaas Deforche" wrote:
>>>>> On Tuesday, December 22, 2009 4:24 PM Justin Biggs wrote:
>>>>> You should not need to change anything in the fetch() method in this case.
>>>>> All you need to do is pass your printJobSettings into the SalesFormLetter
>>>>> class and pass that class as the caller (instead you are setting the caller to