Announcement

Collapse
No announcement yet.

Replace newlines in text field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Replace newlines in text field

    Hi all,

    I was wondering if and how the string\replace formula can be used to find and replace a newline by "\n". I want to format plaintext as json.
    If there is any other way to do this, I'm also open to that!

    Thanks!

  • #2
    The replace should work, so does the \n string, here is my posted about replace string:
    https://docs.espocrm.com/user-guide/...sions/#replace (https://docs.espocrm.com/user-guide/complex-expressions/#replace) (Please note, I mistakenly used Complex Expression instead of Formula, however there is a solution for both method thanks to item and Maximus) I'm trying to use the replace formula and having difficult with


    I can't find the post where I talk about new line (and other poster too).

    I haven't really try both of them together yet.

    In term of JSON, isn't JSON is just plain text, so it should be possible to format it in JSON style.

    Comment


    • #3
      I just wanted to share my formula for anyone needing to remove a line break

      FIELD NAME=string\replace([[FIELD NAME]], '\n', '');

      This will take this for example

      Hello
      World

      and turn into

      Hello World

      Comment

      Working...
      X