Good morning Mega-Minds! I’ve created a method in a Dashboard button click event that creates a new quote with a selected ProjectID, and then it adds parts to the quote. I also want it to automatically run the SSRS report for the quote as a PDF, then copy that PDF to a folder. I’ve got the quote creation and part adding parts working perfectly, but the running of the report and PDF creation is where I’m running into issues. The image below shows all the code I’ve put together from various website articles regarding this topic…
So, I think I’ve got the code working for running the report, but now I need a way to get the PDF so I can move it to a network folder. Any suggestions will be appreciated. Thank you for your time and have a great day!
Please don’t ever connect to the database from the client. That is a supremely bad idea particularly for security, upgradability , maintenance, and everything in-between.
Thanks Jose! I get that I can create a BAQ to get the info I need from the database table. But how do I get the PDF of the SSRS report? Ultimately, all I’m trying to accomplish is running the report with the new quote number that’s created and then generate a PDF file that can be placed in the quote’s folder.
As I am following along, I am able to get the RptData and convert it to a base64 string and then when I plug that into the base64 guru converter from Jose’s video, it shows me the PDF file that I was trying to get. So far so good.
Is there an easy/preferred way to take those bytes and attach them to an email in a BPM? Do I have to save it to a file? For some reason, I was not having any luck actually getting the file to write to the C:\ path I specified… no error. just didn’t work. But when I show the string in a message, I can copy/paste it and that part works. Ideally, I would just take the bytes and attach it to the email. But the attachment in SmtpMail seems to want to attach from a file path.
The BPM is running at the server, so you’re trying to write to a server file location that the app server does not (and should not) have rights to. The only safe place to write to on the server is the EpicorData folder.
There’s a lot of steps in that video that just won’t work for what I’m trying to do. I need it done all programmatically because this will be for Project Managers who don’t have enough tech experience to copy, paste, convert, etc.
I just need code that will run the report, which I’ve got, and then create a PDF to a folder and open it for viewing.
Because you are using the adapter that byte array is not a base64 encoded string, so you don’t need to do toString or anything else just cast to a byte array.