Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

How to Personalize the Workflow content into Alert Activity.

Avatar

Level 3

Hi,

I am trying to add the outbound transition content into alert activity for personalization. The image of workflow i added below. The alert activity is not populating the workflow content to the notification mails. In notification mail it sending only the text content present in alert activity not the content coming from previous activity. Below is the code iam using javascript activity as well alert actvity.

1838776_pastedImage_0.png

javascript activity code:

var query =xtk.queryDef.create (

<queryDef schema= "temp:query32" operation="select">

<select>

<node expr="@internalName"/>

<node expr="@lastStart" />

<node expr="@fullName" />

<node expr="@name" />

</select>

</queryDef>)

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

Alert Activity code:

<%

var items = new XML(instance.vars.items)

for each (var item in items){

%> 

<%= item.target.@fullName %>

<%= item.target.@internalName %>

<%= item.target.@lastStart %>

<%= item.target.@name %>

<%

} %>

Please help me to solve this issue. Thanks in advance.

Regards,

Ram.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hello Ram & Wesp,

Please have a look on factory ACC workflows using Alert activities, such as:

stockMgt

You will see how to pass the variables from Javascript part to Html part of the Alert activity (the same if the Javascript is done in a prior Javascript activity), it is a question of XML management for storage and reading in instance or event vars.

So in your case, do the same:

Javascript part:

var query = xtk.queryDef.create (

<queryDef schema= "temp:query" operation="select">

<select>

<node expr="@internalName"/>

<node expr="@lastStart" />

</select>

</queryDef>)

var itemsXML = query.ExecuteQuery();

vars.itemsXMLString = itemsXML.toXMLString()

HTML source part (with no format/presentation effort ):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

</HEAD>

<BODY>

<P><%= vars.recCount %></P>

<P>

<br/>

Workflows List Start:

<br/>

<%

var itemsXML = new XML(vars.itemsXMLString)

for each (var item in itemsXML){

%>

<%= item.@internalName %>

 

<%= item.@lastStart %>

<br/>

<%

} %>

<br/>

Workflows List End.

</P></BODY></HTML>

Regards
J-Serge

View solution in original post

5 Replies

Avatar

Level 2

I've been having this same issue and have not yet figured it out.  Below is my previous post with a limited response...maybe you can figure this out from context where i could not:

Help: Adding work table content into a workflow alert

Avatar

Correct answer by
Level 10

Hello Ram & Wesp,

Please have a look on factory ACC workflows using Alert activities, such as:

stockMgt

You will see how to pass the variables from Javascript part to Html part of the Alert activity (the same if the Javascript is done in a prior Javascript activity), it is a question of XML management for storage and reading in instance or event vars.

So in your case, do the same:

Javascript part:

var query = xtk.queryDef.create (

<queryDef schema= "temp:query" operation="select">

<select>

<node expr="@internalName"/>

<node expr="@lastStart" />

</select>

</queryDef>)

var itemsXML = query.ExecuteQuery();

vars.itemsXMLString = itemsXML.toXMLString()

HTML source part (with no format/presentation effort ):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

</HEAD>

<BODY>

<P><%= vars.recCount %></P>

<P>

<br/>

Workflows List Start:

<br/>

<%

var itemsXML = new XML(vars.itemsXMLString)

for each (var item in itemsXML){

%>

<%= item.@internalName %>

 

<%= item.@lastStart %>

<br/>

<%

} %>

<br/>

Workflows List End.

</P></BODY></HTML>

Regards
J-Serge

Avatar

Level 2

Thank you so much for sharing this. It was something that we have been looking to do as well. Could this be modified to only return distinct records in the final alert? For example, we are including the project name in the alert. Some records will have the same project name and we only want to show that once in the email.

Avatar

Level 10

One more thing:

Don't forget the other less clean solution, when the Javascript code is small like Ramprakasht's demand, you can put all the queryDef code inside the HTML source tab, so no XMLString() to do.
Well I do it sometimes, but I know, it is better to separate business logic and HTML format/presentation.

Regards
J-Serge

Avatar

Level 2

This worked perfectly.  Thank you!