Sending report via workflow

priyal_b

12-12-2017

Team,

Is there any way to send a report via workflow ?

I see there is a topic about this: Sending a report to a list

I am trying different way via normal delivery and few of recipients but trying to incorporate the java script from this topic within workflow but its giving an error.

----

js JST-310000 Error while compiling script 'SWKF9679/js' line 8: missing = in XML attribute (line='_context_"global"/> ' token='"global"/> ').

----

Is there any way to incorporate out of the box report within delivery as an (calculated) attachment?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Jean-Serge_Biro

MVP

02-02-2018

Hi Alistairk,


Everything can be done, but it is often tricky... fortunately there is the debug view to see the context elements/attributes (and so parameters/values available asURL GET parameters).

For instance, if you need a report specific to a delivery, but without having a Adobe Campaign operator (anonymous mode), you can achieve the query activity in the report with a deliveryId parameter (URL) and deal with it as is:

http://yourdomain/report/RPT_hoturl_anonymous_access?_selection=7703921301409139_pastedImage_0.png

1409140_pastedImage_4.png

Regards

JS

Answers (20)

Answers (20)

Amit_Kumar

MVP

08-02-2018

Hi Priyal,

I am not sure if you can solve your problem with J-Serge's response, but if you are still looking for the same, please refer to below list of the variables you can use in context in your script fro standard reports.

   

Name of a variableDescriptionExample of a value
_reportContextInternal name of the reportopensByUserAgent
_contextReport contextselection
_hasFilterAdvanced filterFALSE
_selectionCounthow many you have selected1
_selectionid of selected record56855633
_schemaTarget schema of reportnms:delivery
_folderModelfolder template for target scemanmsDelivery
_folderLinkIdid of the selected folder@folder-id
_folderLinklink name of folderfolder

Regards,

Amit

Jean-Serge_Biro

MVP

02-02-2018

Hi Priyal,


The behavior is normal, because you defined the _context parameter with "global" value.


To be able to restrict/select to a or some deliveries, you must firstly allow your report properties not be only global but contextual:

1409070_pastedImage_0.png

Then, the report workflow must deal accordingly to you delivery/several deliveries/global context.
See for instance the factory report statisticsPerDelivery (with Test activity) in case of both global or selected deliveries behavior).

If only one or several deliveries are allowed (not global case) then refer for example to the factory deliverySending report.
In all cases the first Query activity should have the Filter with context checkbox selected:

1409071_pastedImage_1.png

Of course, in some scenarios (for example doing code in Javascript activity), you can manage the defined records to select programmatically.

By the way, if you could mark our replies as helpful and mark it as correct when completed and satisfactory, it would be appreciated so we can see in the forum list that the ticket is not to be dealt with.
Many thanks in advance.


Regards
J-Serge

Jean-Serge_Biro

MVP

12-12-2017

Yes, the documentation example was given with a Windows server in mind, so the syntax such as D:\Temp folder (if you don't give a full path, it is written in the workflow process folder).

On linux, you would have a folder such as /tmp/blablabla/ (no C:\ drive letter); or let it in the wkf subfolder, as you prefer.
For my part, I prefer defining specific folders outside the Adobe Campaign path. Do what is convenient for you

Regards
JS

priyal_b

12-02-2018

I would like to thank everyone for helping resolving this query.

As of now this thread can be closed, I have pasted my script above, which works for now.

I will try to take it to next level and will open thread for discussing issues with this reporting automation.

Thanks

PB

priyal_b

12-02-2018

Hi asjohnso,

Yes your workflow could take very long time to stop probably days if your customer has launched millions of emails from Campaign.

Since you are pulling as global context, its trying to capture all the emails that ever sent out from all campaigns/deliveries.

Here is the script you could use to limit via selection and pass delivery pk.

~~~~~~~~~~~~~~~~~~~

var reportName = "deliveryFeedback";

var path = '/usr/local/neolane/nl6/var/' + getOption('NmsTracking_Instance') + '/export/test3'+formatDate(new Date(), "%2D%2M%2Y")+'.xls';

logInfo(path);

var exportFormat = "XLS"; // export format

isAdHoc = false; // is ad hoc?

var _ctx = <ctx _context="selection" _reportContext={reportName} _selection= "24817905" />; //context selection and delivery Pk

xtk.report.export(reportName,_ctx,exportFormat,path,isAdHoc); //submit request

~~~~~~~~~~~~~~~~~~~

Hope this helps!

Thanks!

AJOHNSON3

11-02-2018

Hi Priyal,

Can you please share here the script that worked out for you with the XLS option. Running OK for one of our customers but the workflow not stopping. I think there is an issue with the javascript.

1415817_pastedImage_2.png

priyal_b

08-02-2018

Thanks Amit!

I will try few of these to restrict the script of pass only few deliveries/folder.

Is there any other way you are ware of automating reports?

I am trying multiple ways if possibility to automate for campaigns.

Thanks!

priyal_b

07-02-2018

I think I get the point that, we could have report single/multiselect , instead of global it looks for "selection" context type, which I am not sure if possible from script, because the way I am trying to achieve is, from workflow standpoint, where the actual workflow is part of a campaign....so hypothetically the need to read current campaign (name/internal name) and/or delivery internalName, with the help of java script or variables. Eventually achieving those parameters passed to report, that should restrict/ pull stats for that particular campaign.

There are reports they look like they read these directly based on delivery selection(s), trying to evaluate those java scripts.

Please do share your opinions if my hypothesis is wrong or your suggestions.

Appreciate your help!!

priyal_b

07-02-2018

Thanks Jean-Serge !

Super helpful, I am going to give it a try in next couple days and update here.

I am planning to duplicate one of deliveryFeedback and use single/multiselect and will try to call it from the workflow.

alistairk161838

02-02-2018

Hi J-Serge,

Thanks for this - it's very helpful. What would be the other ctx variables you would use for these reports? Global is fairly obvious, what parameters would you use to pull a campaign level report or a delivery level report? Would the correct parameter for these be an exact copy of the selection type (Single-selection etc...) or something different.

This is of course assuming that your report is set up to allow this level of reporting.

Thanks!

florentlb

02-02-2018

Hi Priyal,

Not sure if there's a parameter I don't know much about v6 reports. I'd have assumed that it was be specified in the "context".

Florent

priyal_b

24-01-2018

Hi florentlb,

Sorry for delayed response, yes now the script is working but for XLS with Adobe's resource help, we were able to fix the java script and run and email a report automatically.

Initially I thought this process would associate report only related to particular campaign/workflow its built into, but it captures the report for all the emails that went out from Adobe until that time. for example if I were to specify "deliveryfeedback" report, is there any way to specify the campaign name or delivery name based off which report will be calculated ?

If there is some parameter that can be passed in the java script to mention a campaign/delivery internal name or label to to restrict this automated report to a campaign/delivery?

Thanks in advance!

priyal_b

24-01-2018

Hi florentlb,

Sorry for delayed response, yes now the script is working but for XLS with Adobe's resource help, we were able to fix the java script and run and email a report automatically.

Initially I thought this process would associate report only related to particular campaign/workflow its built into, but it captures the report for all the emails that went out from Adobe until that time. for example if I were to specify "deliveryfeedback" report, is there any way to specify the campaign name or delivery name based off which report will be calculated ?

If there is some parameter that can be passed in the java script to mention a campaign/delivery internal name or label to to restrict this automated report to a campaign/delivery?

Thanks in advance!

florentlb

02-01-2018

Hi Priyal,

As Jean-Serge mentioned, given the error, it seems your Campaign application server is installed on Linux. So you'd want to use paths that can be accessed from the server. Please check that with your admin or with Adobe's support team if your instance is hosted by Adobe.

Florent

Jean-Serge_Biro

MVP

13-12-2017

Hi Priyal,

I don't understand, indeed. The path /usr/local/neolane/v6 is typical of a Linux installation.
Please check with your admin.

Regards

JS

priyal_b

12-12-2017

Thanks Jean!

Now I am getting another error for export.

1371610_pastedImage_0.png

here is the javacode I am using:, not sure if the export error is because campaign cannot write to local c:\\?

Should it be a server url (adobe cloud may be?)

1371617_pastedImage_1.png

Thanks!

Jean-Serge_Biro

MVP

12-12-2017

Hi Priyal,

Please may you paste your Javascript code equivalent of that one given in the documentation:

var _ctx = <ctx _context="global" _reportContext={reportName} />xtk.report.export(reportName,_ctx,exportFormat,path,isAdHoc)


You should check for syntax, it seems you don't have put a = but a _ if I understand the error:
_context_"global

Regards
J-Serge