How to Personalize the Workflow content into Alert Activity.

ramprakasht3196

01-10-2019

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.

Accepted Solutions (1)

Accepted Solutions (1)

Jean-Serge_Biro

MVP

03-10-2019

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

Answers (3)

Answers (3)

Jean-Serge_Biro

MVP

03-10-2019

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

wesp27904446

01-10-2019

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