Sending report via workflow | Community
Skip to main content
priyal_b
Level 3
December 12, 2017
Solved

Sending report via workflow

  • December 12, 2017
  • 21 replies
  • 9060 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jean-Serge_Biro

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=770392130

Regards

JS

21 replies

Jean-Serge_Biro
Level 10
February 2, 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:

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:

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

Level 3
February 2, 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!

Jean-Serge_Biro
Jean-Serge_BiroAccepted solution
Level 10
February 2, 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=770392130

Regards

JS

priyal_b
priyal_bAuthor
Level 3
February 7, 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.

priyal_b
priyal_bAuthor
Level 3
February 8, 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!!

Amit_Kumar
Level 10
February 8, 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

priyal_b
priyal_bAuthor
Level 3
February 8, 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
priyal_bAuthor
Level 3
February 8, 2018

Everyone,

This is working now, I will post more details once I validate few more things.

Thanks everyone for your help!

PB

February 11, 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.

priyal_b
priyal_bAuthor
Level 3
February 12, 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!