K2 Mail Event Hyperlinks

I had a situation where I needed to email a user from within the workflow process using a mail event with a dynamically built url generated from a stringtable entry detailing the start of a url and a datafield value containing a reference id in the email body. I found that no matter what way I concatenated the two values together or added href anchor tags to the body of the email, the email would be received showing the link but without it formatting itself as a hyperlink.

The resolution to this was to concatenate the values together along with the html tags in a server side code event and store this value in a datafield before the mail event item was reached.

The code ended up being:

K2.ProcessInstance.DataFields["Hyperlink"].Value = 
string.Format("<a href="{0}{1}">{0}{1}</a>", K2.StringTable["UrlString"],

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
background-color: #f4f4f4;
width: 100%;
margin: 0em;
.csharpcode .lnum { color: #606060; }

Hope this helps someone else out there.

Published by kievia

Christian, Geek, Youth Worker, Bookworm