How to Retain the New line / Carriage returns when Pulling Data from Custom Table via UI Macro/Jelly code

Chris Armstron2
Giga Expert

Hi,

I am needing to know how to retain the new lines / carriage returns that are stored in a custom table-

The issue at hand-

When I enter notes into a Journal field, the data is kicked out with the new lines / carriage returns, removed:

Before:

After:

What is happening behind the scenes--

There is a Before Insert and Update Business Rule that is sending the data/text to a custom table called:  u_jh_encrypted_journal.  Here is the Business Rule script:

Here is how the data is displayed within the custom table (it has the new lines / carriage returns):

But in the same breath, when I show xml for the above, the text is flattened out:

In order to repopulate the data under the Journal field, we are using a Macro to pull the data from the 'u_jh_encrypted_journal' table.  Here is the Macro code:

But unfortunately, the Macro is not retaining the new lines.

How would I go about modifying the code to ensure that the new lines are kept?  I've tried getValue and getDisplayValue and both return the same (i.e. new lines removed).

Maybe there is a jelly method to get the form value like within client side scripts 'g_form'?

Thanks,

Chris A.

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

The thing to note is that journal fields are not formatted text. how about turning your custom u_jh_notes in to an HTML field, then cc the content in to work_notes and your custom table?

View solution in original post

9 REPLIES 9

And sure enough...it worked like a charm! Really appreciate it Chuck!

New output:

find_real_file.png

Chris Armstron2
Giga Expert

Hi Chuck,

The usage of the HTML field definitely works, but it does throw a wrench into another process which I discovered during testing just now. And if I need to open up a new post, I most definitely will.

We have a SOAP integration built out that leverages business rules to update and insert data, from the incidents, to a DB Table on our side.  It appears that adding the HTML field produces the following output in our database table:

find_real_file.png

Would you know of a method to remove the html attributes from the text when being sent over to our side?

I am going to start researching this now, but figured I would ask you first 🙂

I suspect I could use regex for pattern matching to remove/replace the html attributes, but maybe there is a better method.

Thanks,

Chris A.

You can use RegEx to remove HTML from a string quite easily. Here's a line of code I use for a personal project where I download HTML and strip out the HTML tags.

var noHTML = rawText.replace(/<[^>]*>/g, '');

Cool.  I'll give regex a go and report back.

Was just thinking that maybe there was another built in function similar to 'setStringParameter();' in order to remove HTML from being sent over.

That worked like a charm! Thank you so much Chuck!