ForceCLI/force

Cannot seem to insert a carriage return line feed (CRLF) into a text area field

Closed this issue · 5 comments

Have searched the UpdateRecord() function, and from what I can tell it is not facilitating escaping/transposing the characters to yield an actual line feed.
Have tried multiple approaches such as embedding in the text to update
, , BR(), , /r/n, /n/r (also double escaping with //), but all are simply interpreted as text and end up in the field without being transposed to an actual line feed.

e.g. all of these update SFDC, but do not add a line feed, they simply also add the /n/r or BR() as text;

  • force record update task field:"Line 1 text to insert/n/rLine 2 more text"
  • force record update task field:"Line 1 text to insert"/n/r"Line 2 more text"
  • force record update task field:"Line 1 text to insert"BR()"Line 2 more text"

You can include line breaks in command, e.g.

$ force record update task field:"Line 1 text to insert
Line 2 more text"
$

or

$ force record update task field:"$(echo -en 'Line 1 text to insert\nLine 2 more text')"

Thanks for the quick reply.. although cannot seem to get it to work - imagine I will kick myself when I find what I am doing wrong!

  1. First option sends/executes the command on line break even if in a batch file (cmd.exe windows).
    I see references online to using a carat to escape the line break, but that just seems to cat the lines?

  2. Second option using cmd.exe on windows I entered this and the got "Record Updated";
    force record update task description:"$(echo -en 'Uploaded by: Sales Rep\nFor: Customer')"

The field in SFDC literally shows the "$(echo" as text;
"$(echo -en 'Uploaded by: Sales Rep\nFor: Customer')"

No dice!
Thanks though - have given me some alternate ideas to chase down. If I can make it work I will comment back here.

MrDOS commented

Try hitting “Enter” again at the “More? ” prompt:

C:\>force record update task field:"Line 1 text to insert^
More? 
More? Line 2 more text"

The ^ character is just an escape that lets you enter special characters literally. It does not insert a newline immediately; it just lets you enter one. You can see this behaviour in action with echo:

C:\>echo one^
More? two
onetwo

C:\>echo one^
More?
More? two
one
two