Line breaks in API values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mkas
    Junior Member
    • Feb 2021
    • 26

    Line breaks in API values

    Hey there,

    I have a form which collects information from a user, and I want to concatenate that into a single variable (to go in the description field in Espo). Everything is working fine, except that I can't add line breaks into the string.

    Here is my current code:
    Code:
    $message = "This is the message here";
    $ipAddress = "123.123.123.132";
    
    $desc = 'Message: ' . $message . ' | IP Address: ' . $ipAddress;
    This is what I get (which is exactly what I expect from the above):
    Code:
    Message: This is the message here | IP Address: 123.123.123.132
    This is what I want:
    Code:
    Message:
    This is the message here.
    
    IP Address:
    123.123.123.123
    Here is what I have tried:
    Code:
    $desc = 'Message: <br> ' . $message . ' <br><br>IP Address:<br>' . $ipAddress;
    Code:
    $desc = 'Message:/l/n ' . $message . ' /l/nIP Address:/l/n' . $ipAddress;

    In each scenario, the characters I am entering in the string are just displaying in the description box, as in, it's not recognising it as HTML code, but as plain text.

    Does anyone have any thoughts?
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    #2
    I believe line break is \n for EspoCRM not /n

    Do a test in Formula I guess.

    Comment

    Working...