Post

2 followers Follow
1
Avatar

Add a Line Break to Custom Action TextArea Field

Hi all,

I am working on some custom actions for requests and am concatenating a few user input text fields into the description field of the request. 

Currently I have (anything not in quotes are variables from the user input form):

"New User Name: " + NewUserName + "; " + "Email: " + UserEmail + "; " + "Direct Manager: " + DirectManager

I'd like to add line breaks for legibility, but have found <br> isn't working.   I thought it might be something with my syntax so I just tried using two variable names and a break between the two...

NewUserName<br>UserEmail

...but I get a syntax error that a $FieldName is expected.

Are line breaks not feasible in this scenario?

I've also tried to create a variable (textarea) to concatenate the text fields with line breaks, but that also didn't work.

My hope is this is just a user error on my part.

Thanks!

Jen

Jen L Brune Answered

Please sign in to leave a comment.

10 comments

1
Avatar

Got it!

 

use \n instead of <br>

 

"New User Name: " + NewUserName + "\n Email: " + UserEmail

 

works in my environment - do leave a space between the n and the next word - it won't show in the actual text

Robin Head 1 vote
Comment actions Permalink
0
Avatar

Heya,

I've used html syntax (  br in triangle brackets )successfully in these situations - as part of the string. "Line1
line2"

However, I'm not sure whether this works with the description field as it's not a rich text field

 

Sorry I can't type the actual line breakbcommand as it converts it in this post. 

Robin Head 0 votes
Comment actions Permalink
0
Avatar

LOL Apparently the * didn't help keep the html from working in the post either!  Thanks for both attempts.  I wish I could see them!  LOL

Jen L Brune 0 votes
Comment actions Permalink
0
Avatar

It's exactly how you managed to write in your post. Between newusername and useremail.

Insert that linebreak br command at the beginning of the string for email (or whatever else you want to appear on the next line) "string1" + variable1 + "LINEBREAKCOMMAND string2"+ variable2

Robin Head 0 votes
Comment actions Permalink
0
Avatar

Thanks, that's exactly what I tried before, but it didn't work.  I've tried again and included the + between variable and the <br>, but get an invalid input error for the '<'.

"New User Name: " + NewUserName + <br> + "Email: " + UserEmail

It could be that it is not a rich text field, but I swear I read elsewhere that the line breaks should work in a TextArea field which the Description field is... bah.  Thanks for your thoughts on this.

Jen L Brune 0 votes
Comment actions Permalink
0
Avatar

Sorry Jen this is not what I meant please move the Breakline command into the " " (unless you've tried that already)

Robin Head 0 votes
Comment actions Permalink
0
Avatar

Sorry, I've switched to my laptop -hopefully this works now:

This is what I meant:

"New User Name: " + NewUserName + "<br>Email: " + UserEmail

Robin Head 0 votes
Comment actions Permalink
0
Avatar

OK I've just tried in my environment

It doesn't convert the <br> in the description field if it is in the string - so my conclusion is that as the description field is a single line field it is not able to do this. This is exactly how I use this for many other text fields (Audit trail comments etc) and it works no problem - only difference is that these fields are rich text fields.

 

 

 

Robin Head 0 votes
Comment actions Permalink
0
Avatar

Forget what I just wrote as it is possible to manually write multiple lines .. maybe it just means that html formatting commands don't work .. 

Robin Head 0 votes
Comment actions Permalink
0
Avatar

It works!

Thank you, Robin, for continuing to work on this conundrum.  I appreciate it.  It saves me a lot of head banging and a call into a webinar!

Thank you!

Jen

Jen L Brune 0 votes
Comment actions Permalink