Mail event smartobject property loses formatting

  • 23 February 2015
  • 6 replies
  • 2 views

Badge +5

I have an email event which uses a smartobject's  'memo' type property to map a value, from the underlying SQL database, into the message body.  The mail event wizard's 'message body' is set to HTML. When the email is received in Outlook, any formatting is lost (the format I'm particularly interested in retaining is line breaks).  This formatting does seem to be retained when testing the smartobject in the smartobject services tester tool (ie I copy the value out, paste it into Word and it keeps the line breaks).

 

I'm using blackpearl 4.6.6 and in Outlook my email format is set to HTML.

 

Any advice would be appreciated.

 

Thank you in advance

Rachel


6 replies

Badge +10

Hi,

 

Because your formatting is HTML any line breaks will be stripped out.

Word does its own thing with HTML and converts it to its own version of HTML and that is probably why it keeps your line breaks.

 

What you need to do is replace all of your line breaks with <br /> (break) tags. 

K2 will honour the HTML break tag and insert a line break there.

 

I have personally done it like this and it works.

 

Regards,

JohanL

Badge +5

Thank you very much for the response Johan.  Could you just confirm if you did this within workflow, at the point of retrieving the value, or whether you did this at the point of originally saving the value to the database?  If the former, could you confirm the 'Find' value for the Replace function?

 

Thank you

Rachel

Badge +10

Hi,

 

If I were you I'd change it in the DB because it will be the source of your notification.

I would take the text in the DB and paste it into a text editor.

In there everywhere you would expect a line break type the break tag.

When done save it back to your DB.

 

Let us know if it works.

JohanL

Badge +5

Thank you for the prompt response! Yes I can confirm it does work with <br /> held in the database. I'm reliant on someone else making this change though so just wondered if the 'Replace' function within workflow could be used instead. I've tried values '
' and 'CHAR(13) + CHAR(10)' as the 'Find' value but to no avail.

 

At least there is a solution though - thank you very much for your help, it's much appreciated.

Rachel

Badge +8

I disagree that changing it in the DB is the appropriate answer.  By changing the string in the db, you are introducing data in the db that is not part of the original content.  You will likely experience compatability problems with other applications and formatting issues when users provide inconsistant input.  Not to mention that this is a very rigid solution.  What happens in a few months when you decide to change from <br/> tags (the poor man's solution) to wrapping paragraphs in <p> tags (which is what you should be doing anyways)?

 

The better solution is to run the replace operations within K2 and handle your formatting there.  We went so far as to write a user-defined function in K2 for the sole purpose of converting plain text line breaks to HTML paragraphs.  You could (probably) accomplish the same thing with a SQL function.

Badge +5

In the end I used a stored procedure to perform the REPLACE function (with CHAR(13) + CHAR(10)) and returned the output to a smartobject, referenced in the email body.

Thanks again for your help :-)

Rachel

Reply