Hello!
I'm automating some Message Center reports, using this as a basis:
I'm specifically looking at the "Message Center Service Level" report, and I'm getting a basic PDF generated using this code:
var reportName = "messageCenterQualityOfService";
var path = "/home/customers/specsavers/incoming/Temp/mcqos.pdf";
var exportFormat = "PDF";
var _ctx = <ctx _context="global" _reportContext="messageCenterQualityOfService" />
var isAdhoc = 0;
xtk.report.export(reportName, _ctx, exportFormat, path, isAdhoc);
This generates a report based on the default parameters, "Channel", "Execution Instance" and "Period".
Can someone help me set the "_ctx" parameter so that I can generate the report for different "Periods". e.g. "1 week view" via JavaScript?
Thank you!
Views
Replies
Total Likes
Hello,
Is it possible to check the debug view to see the context elements/attributes (and so parameters/values) available?
Views
Replies
Total Likes
Thank you, imicu.
I'm so sorry, how do I see the debug view of the report? It's an out-of-the-box report:
Many thanks!
Views
Replies
Total Likes
I do not have that report in my sandbox, but what you can do it to go to Explorer > Administration > Configuration > Reports
From here you have 2 options:
<vars> <period>7</period> </vars>
All the variables defined in the variables tab are accesible under the ctx.vars.yourVariable
Once you identify the variable, you can use it in JS script by accessing with:
ctx.vars.period = <VALUE>
Hope this helps.
This is really helpful, thank you!
I've debugged, and have the parameter and value that I need to run the report for a 2-week period (period=336). However, after amending my JS I still get a default report (24-hour period).
var reportName = "messageCenterQualityOfService"; var path = "/home/customers/specsavers/incoming/Temp/mcqos.pdf"; var exportFormat = "PDF"; var _ctx = <ctx _context="global" _reportContext="messageCenterQualityOfService" /> _ctx.vars.period = 336; var isAdhoc = 0; xtk.report.export(reportName, _ctx, exportFormat, path, isAdhoc);
Is this code correct?
Sincere thanks for your help - I'm definitely having "a moment" here!
Views
Replies
Total Likes
I believe it is suppose to be
ctx.vars.period = 336;
without underscore.
Hi and thanks for your help!
This causes the workflow to fail with the error:
24/08/2022 15:54:51 JST-310000 Error while compiling script 'WKF69644/js' line 7: ctx is not defined.
Any thoughts?
Views
Replies
Total Likes
Hi!
Sorry to keep bothering you about this!
I'm getting this error when using trying to reference "ctx.vars" in my JavaScript activity:
JST-310000 Error while compiling script 'WKF69644/js' line 7: ctx is not defined.
I'm guessing this is a Message Center "thing", but I'm not sure what to do about it. I'm running my Workflow in our campaign/control instance and the code is in a JavaScript activity, if that it relevant.
Any thoughts?
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi @IainOllerenshaw,
Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks!
Views
Replies
Total Likes
No luck, unfortunately. I'm following this guide which makes use of a JavaScript activity. According to the documentation, there is no "ctx" object that I can use in this activity, yet that seems to be the recommended solution. I'm very new to this aspect of Campaign, so struggling a bit!
Views
Replies
Total Likes
Any help here? I haven't been able to get any further with this.
Views
Replies
Total Likes
Views
Likes
Replies