Email event HTML format issue

  • 7 January 2013
  • 6 replies
  • 1 view

Badge +4

Hi there,


I am experiencing issue of sending email in html format in K2 E-mail event.


(I cannot make pasting screenshot work in the post. I have to describe it below.)


 Basically, I want to hide the url from user and  the email recepient clicks the Here link in the email.


This is what I did in E-Email event Message Body, I select "HTML", then write:


<a href ="http://mysite/forms/hr/leaveform/(I select ListItemRelavtiveURL from xml fields, and it is green highlighted )&ampOpenIn=Browser>here</a>


 But in the received email, the url link won't work. When I check the source code, I found it is like:


<a href="http://http:/mysite/forms/HR/Leave/%3c/span%3e%3cspan%20style='font-family:Arial;font-size:11pt;font-weight:Normal;font-style:Normal;font-stretch:Normal;color:#000000;text-align:Left;text-decoration:None;line-height:1'&gt;/forms/HR/Leave&lt;/span&gt;&lt;span style='font-family:Arial;font-size:11pt;font-weight:Normal;font-style:Normal;font-stretch:Normal;color:#000000;text-align:Left;text-decoration:None;line-height:1' id='r")&ampOpenIn=Browser>here</a>


 It seems K2 email event put the metadata of formatted data field (green highlighted text) in the email instead of the text.


How can I handle this? I am using K2 4.5.3.


 


If I use text format, it does not have such issue.


 


thanks,


David


6 replies

Badge +8

Try using the Hyperlink inline function to format URLs properly (found in the Text category). This will return the formatted text as a proper anchor tag without the additional formatting.

Badge +4

Just tried Hyperlink inline function. My goodness, Hyperlink function itsself is with additional formatting.


 


href="http://mysite/forms/HR/Leave/_layouts/K2/RuntimeServices/OpenInfoPathTask.aspx?K2Server=&lt;/span&gt;&lt;span style='font-family:Verdana;font-size:10pt;font-weight:Normal;font-style:Normal;font-stretch:Normal;color:#000000;text-align:Left;text-decoration:None;line-height:1.5'&gt;&lt;a href=" TORK2WFQ1:5252?="">K2Server</a>

Badge +9

Hi, Try this..


this.EmailMessage.IsBodyHtml = true; in private void SendMail_ExecuteCode(object sender, EventArgs e)  of email event codelevel file


http://www.k2underground.com/forums/t/7756.aspx


 

Badge +4
Hi Srikanth.ch,
How to get to codelevel? I cannot find it in K2 studio or K2 Designer for VS2005.

thanks,
David
Badge +8

Make sure that you use an expression for the URL parameter of the Inline Function. I have just tested this using 4.6 (but I have used this in 4.5 too) and it works as expected. My expression looks like the following:


 [Forms URL] & "/Form/New+Vendor+Form/?ID=" &  [ProcInstID] 


where items in brackets are variables dragged in from the Object Browser. 

Badge

I recently ran into a similar issue and I have blogged the solution I have come up with.

 

http://blogs.claritycon.com/blog/2014/10/k2-blackpearl-adding-url-links-email-message-body/

 

Hopefully this is helpful to others.

 

sVemula

Reply