Hello,
I am trying to add content from my workflow into the body of an alert. I'm using the process outlined by Adobe via inserting a javascript code activty. The workflow appears to run but the alert is not properly populating with the data. Below is the code i am using in the javascript activity as well as the alert. Any insight into what i'm missing here would be much appreciated!
Javascript Activity:
var query = xtk.queryDef.create(
<queryDef schema="temp:query2" operation="select">
<select>
<node expr="[/@label1]"/>
</select>
</queryDef>
);
var items = query.ExecuteQuery();
Alert:
<%
var items = new XML(instance.vars.items) for each (var item in items){
%>
}%>
Solved! Go to Solution.
Hi Wesp,
See also my answer in this post:
How to Personalize the Workflow content into Alert Activity.
Regards
J-Serge
Hi,
Alerts (deliveries) don't have access to workflow's vars. You have to ship data through one of the activity's properties, usually title or message.
In the initialization script of the alert activity (under Advanced), add this:
activity.message = instance.vars.items;
And then in your alert:
<% var items = new XML(dataSource.message); ... %>
I have a library that formalizes this approach and provides a shared scope across workflows and deliveries, should be how the product works really.
Thanks,
-Jon
Hello John,
Thank you for your help. Would you mind providing additional clarification on the second part? I'm unclear as to where this is pulling from or what else needs to be added here to populate with the data from the work table. Apologies for my lack of knowledge on this.
Views
Replies
Total Likes
bump
Views
Replies
Total Likes
Hi you need to add additional variables info to your JS code after - var items = query.ExecuteQuery();
------------------
for each (var row in items )
instance.vars.label= row.@label1;
------------------
then in alert use this instance var as- <%= instance.vars.label%>
Hope this helps.
Hi Wesp,
See also my answer in this post:
How to Personalize the Workflow content into Alert Activity.
Regards
J-Serge
Views
Likes
Replies