Report Inbox - NAV 2016 Any Help

Hi Folks -

I have been asked to create a report that will run through the Report Inbox table save the report as PDF and attach the report to email and send it to the user id in report inbox table. The help I need is to save the report as PDF, I am using


Unfortunately I am not sure how to get the REC from the report inbox table. I have the report ID in the Report Inbox table but to save it as PDF how do I get the REC part. If I am on a Posted Sales invoice I know the record I am on but from Report ID I just don’t know how to get the REC part.

Also, in the Report Output field in the Report Inbox table the report is saved in a BLOB field but again I am not sure how to extract the report from BLOB field and save it into a file.

Any help is highly…highly…appreciated.



One Question - If you have to traverse through Report Inbox Table then why you need REC?
The Report Inbox table already have the report output saved in the user selected format and you just need to email it.
One More thing -
Report Inbox table will have content always until user does not delete it, so either create a boolean in table that provides info. that record have been emailed or Delete the record after you sent email.

Many Thanks Saurav, If I am not wrong the report output is saved in the field Report output BLOB field in the Report inbox table and when user clicks on Show option or double clicks on the entry in the Report inbox it basically at that point of time reads from the BLOB file and puts it into the specified option viz PDF, Excel or Word based on what options were selected during scheduling the report. I also created a process to read from the BLOB field and create a file and it attaches the file just fine but when I try to open the attached file in the email it tells me that it’s either corrupted or incomplete.

HI Sbhatbng,
I think the extraction code from blob to respective file is incorrect. Will it be possible to share that code here and then we can check that is the code correct to extract file from blob field or not.
You can also test the code just by extracting the file in a pre-defined path. I think the extraction process have issues, it is suerly not related to emailing process.

Hi Saurav -

Below is the Part of the function that writes from BLOB value of report output to file.

Variables for function
Data Instream
ValueLine Text
FileName File

SendEmailWithAttachment(VAR:ReportInbox) //Parameter for this function
ReportInbox.calcfields(“report output”);
if reportinbox.“report output”.HASVALUE then begin
FileName.create(‘C:\reportinbox.“report name”+’.PDF;
reportinbox.“report output”.createinstream(Data);
While Not Data.EOS do begin
Valueline := DELCHR(ValueLine,’<’,’ ');

FileName is all created but when the file is attached to a email and sent out and when user tries to open the file it tells me that 2 things, File is either corrupted or File contains invalid characters.

Many Thanks for your time to give your input on this issue.

Surprised that it even compiles!

FileName.create(‘C:\reportinbox.“report name”+’.PDF;

How about this instead:
FileName.create(‘C:’+reportinbox.“report name”+’.PDF’);

Even if it’s not good code either, then it should work. As a general rule of thumb, then never ever “hardcode” drives etc. into your code.