Expand my Community achievements bar.

Include a temporal schema in an alert node

Avatar

Level 3

Hello community,

 

I am trying to include the values of a temporal schema of a workflow in an alert node according to the following Adobe link but it is not working.

 

https://experienceleague.adobe.com/en/docs/campaign/automation/workflows/use-cases/monitoring/send-a....

 

First, I have created a javascript node with this code:

 

var query = xtk.queryDef.create(
<queryDef schema="temp:query2" operation="select">
<select>
<node expr="@label"/>
<node expr="@countField"/>
</select>
</queryDef>
);

instance.vars.items = query.ExecuteQuery();

 

Secondly, I include an alert node with this code:

 

<ul>
<%
  var items = new XML(instance.vars.items);
  for each (var item in items.target) {
%>
  <li><%= item.@label %> - <%= item.@countField %></li>
<%
  }
%>
</ul>
 
However, the generated email shows the following (shows the code without variable substitution)
 
<ul>
<%
  var items = new XML(instance.vars.items);
  for each (var item in items.target) {
%>
  <li><%= item.@label %> - <%= item.@countField %></li>
<%
  }
%>
</ul>
 
Thanks for the help!!
2 Replies

Avatar

Community Advisor

Hi @LAR1985 ,

Write this JS in source tab in Alert activity. Or have a JavaScript activity before Alert activity, Perform queryDef in JS and store the results in a variable. And in alert activity call these variables.

ParthaSarathy_0-1751468303334.png

ParthaSarathy_2-1751468378939.png

Avatar

Level 10

Hi @LAR1985 ,

 

Write below JS to fetch the data from your temp table.

var sql = "SELECT D0.sLabel,D0.sName, D0.sFullName FROM " + vars.tableName + " D0 ";
var qrDeliveryData = sqlSelect("resSQLResult, @label:string, @name:string, @fullName:string ",sql);

vars.deliveryDataTable = '<TABLE BORDER="1"><TR><TH>Label</TH><TH>Internal Name</TH><TH>Folder</TH></TR>';

for each (var resSQLResult in qrDeliveryData) {
  vars.deliveryDataTable += "<TR><TD>"+resSQLResult.@label+"</TD><TD>"+resSQLResult.@name+"</TD><TD>"+resSQLResult.@fullName+"</TD></TR>";
}

vars.deliveryDataTable += "</TABLE>";

And then in your Alert activity, just write:

<%=instance.vars.deliveryDataTable%>

 

Thanks,

Jyoti