Automate Report Sending

alistairk396804

27-02-2017

Hi,

I am looking to automate sending reports to a group of recipients at the end of a campaign.

I am basing this off of THIS use case. I have some queries and questions.

In the Javascript there are two different code examples available in that use case, one in the screen shot and the other in the example code snippet. I can get neither to work. Am I right in thinking there is an ';' missing from the code after _reportContext={reportName} />? If so could the fix be posted?

var reportName = "deliveryFeedback"; var path = "C:\\"+"deliveryFeedback"+".pdf"; var exportFormat = "PDF"; isAdHoc = false; var _ctx = <ctx _context="global" _reportContext={reportName} />xtk.report.export(reportName,_ctx,exportFormat,path,isAdHoc)

Second. The linked use case seems to store a file onto a local drive and then picks this up in the delivery. Is there a simple way to pass this over in the delivery and not involve downloading onto a local drive? My initial attempts to replicate the method I've used to attach files is failing and I'd just like to check if it is feasible.

Accepted Solutions (1)

Accepted Solutions (1)

Vapsy

Employee

28-02-2017

Hi Alistair,

Thank you for sharing the error details.

My intuition was right. If you see the error message your code is trying to look for file on a Linux server inside folder /usr/local/neolane/nl6/var/<prod server address>/ but then moves to C drive.

Linux servers don't have such a setup.

You'll have to give the correct path.

Please modify the line

var path = "/usr/local/neolane/nl6/var/<prod server address>/" + "test_report" + ".pdf";

Hope this helps.

Regards,

Vipul

Answers (8)

Answers (8)

somasundaramh14

16-10-2018

Hi,

I'm also getting the same issue as:

BAS-010017 Cannot read from file '/usr/local/neolane/nl6/var/"my product server address"/' (errno=2, No such file or directory)

Can you please help me with this?

@alistairk39680404

Please let me know how did you fix this.

alistairk396804

28-02-2017

I spoke too soon. It's not 'quite' working as expected. The emailing of the report is working fine. However the report is reporting on EVERY campaign ever sent out. I'll open a new thread though.

alistairk396804

28-02-2017

Hi,

I have resolved the issue and this is now working as expected. I had a leftover piece of script in the delivery which was attempting to source the attachment from the transitional data.

Thanks for all your help Vipul!

alistairk396804

28-02-2017

Hi Vipul,

That still fails I'm afraid.

Also - is there a way to view the various sub folders on the Adobe hosted server? It would be useful to see if the reports are even being generated and stored there.

Vapsy

Employee

28-02-2017

Hi Alistair,

Please use this path inside the delivery attachment

nl6/var/<your_instance_name>/test_report.pdf

Also, no need to put it inside double quotes.

Regards,vipul

alistairk396804

28-02-2017

Hi Vipul,

We're so close. that seems to have worked for the Javascript - I also noticed a small error in my delivery which now rectified allows the delivery to complete. However I'm still getting a delivery failure.

Just to clarify, this is now the path I am setting in my template to pick up the report (again with the prod address removed)

"/usr/local/neolane/nl6/var/<prod server address>/test_report.pdf"

alistairk396804

28-02-2017

Hi Vipul,

This is my code;

var reportName = "aiReportingOverviewDelivery"; var path = "C:\\"+"test_report"+".pdf"; var exportFormat = "PDF"; isAdHoc = false; var _ctx = <ctx _context="global" _reportContext={reportName} />; xtk.report.export(reportName,_ctx,exportFormat,path,isAdHoc)

This is my error - I've removed the prod server address for security puproses;

BAS-010015 Cannot open file '/usr/local/neolane/nl6/var/<prod server address>/C:/test_report.pdf' with write access (errno=2, No such file or directory) SOP-330011 Error while executing the method 'export' of service 'xtk:report'. JavaScript: error while evaluating script 'WKF114/js2'.

It's worth noting that this is an Adobe hosted instance so I wonder if the path needs to be changes to accommodate this. Perhaps remove the C:\\ part?

 

[EDIT] If I remove the C:\\ path the Javascript doesn't fail, however I get the following error on the delivery - again I've removed the server address - 

The delivery has failed XSV-350122 An error occurred and the process has been stopped. SOP-330011 Error while executing the method 'PrepareMessage' of service 'nms:delivery'. SOP-330011 Error while executing the method 'PrepareMessageImpl' of service 'nms:delivery'. BAS-010017 Cannot read from file '/usr/local/neolane/nl6/var/<prod server address>/' (errno=21, Is a directory)

Vapsy

Employee

27-02-2017

Hi Alistair,

Thank you for pointing this out.

We'll ask the documentation team to review the code section.

For the first point, yes there should be a semi-colon or the xtk.report.export statement should be on the next line.

For the second point, the extracted report is saved on the local drive of application server where the campaign is hosted. This is mandatory and cannot be avoided.

Can you share the error you are facing when using the code specified above?

Note: Path defined in code is for server. It means above code will create a file named deliveryFeedback.pdf inside C drive on server. If your campaign instance is hosted on a LINUX server, please change the path accordingly.

Regards,

Vipul