Text area in confiform data conversion
Asked by Markisio:

Hi there

I have a textarea field in confiform and I want use the value/data within the field as is, meaning with breaks upon using data when I send an email for instance:

In textarea I typed

line 1

line 2

however when I send the email with the data within the text area it will show as "line 1 line 2"

please help, thanks


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Markisio](/t5/user/viewprofilepage/user-id/5060391)

Are you using \[entry.field_name\] notation to get the value from you fields or doing it via the ConfiForms Field macro?

I believe it's the first approach, right?

You need to either switch to ConfiForms Field macros (which will render values for the user the way they should be) or[transform the values as needed](https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions), in case you insist on using the \[entry.field_name\] way (as this way you access the RAW value and it is up to you to get it into the right shape and format)

For example using the *replaceCRLFWithBR*function will do what you want on a text are field

Alex

comments: author: Markisio
body: Yes I am using \[entry.field_name\], I will try \[entry.field_name.*replaceCRLFWithBR()\] and let you know*

*thanks*


author: Markisio
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)

it didn't work, I tried \[entry.incidentSummary.*replaceCRLFWithBR* \] and \[entry.incidentSummary.*replaceCRLFWithBR()*\] same issue.

I have that within 'ConfiForms IFTTT Integration Rules' Macro and I am sending an email

thanks


author: Alex Medved _ConfiForms_
body: May I see how are you using that? Could you share a screenshot of your configuration or the storage format?  
and why dont you replace that with a ConfiForms Field macro?


author: Markisio
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)

not sure if I can send a screen shots, as my organization might block it. But here is what I have and hope this helps and thanks for your patience in advance

* I have created Confiform Form Definition
* Within that I have created ConfiForms Form Field Definition called incidentSummary
  * the field type of that is textarea, and required
* Then I created ConfiForms IFTTT Integration Rules, configuration as follow
  * Event: OnCreated
  * Choose Action to Perform: Send Email

in the incidentSummary field I typed:

Line 1

Line 2

however in the email I get: Line 1 Line 2

here is what I have within IFTT Integration Rules

Hello Team

This email letting you know about an incident occurs our Portfolio/PG. Here are the details:

**Incident Summary**:

\[entry.incidentSummary.*replaceCRLFWithBR*\]

hope this helps and thanks again


author: Markisio
body: hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)

so I came up with solution and not sure if that what you meant, I am sure there is a better and more efficient way than below:

* I have created Confiform Form Definition
* Within that I have created ConfiForms Form Field Definition called incidentSummary
  * the field type of that is textarea, and required
* Also created ConfiForms Form Field Definition called incidentSummaryModified
* Created new Confifroms Rules form Definition
  * Value to set: incidentSummaryMdified = \[entry.incidentSummary.replaceCRLFWithBR\]
* Then I created ConfiForms IFTTT Integration Rules, configuration as follow
  * Event: OnCreated
  * Choose Action to Perform: Send Email
  * The email content:

Hello Team

This email letting you know about an incident occurs our Portfolio/PG. Here are the details:

**Incident Summary**:

\[entry.incidentSummaryMdified\]

I find odd I had to duplicate the field form definition + ConfiForms rules to achieve this

I am sure there is a better way :) please advice if this is the target solution


author: Alex Medved _ConfiForms_
body: Hi

There certainly no need for an extra field

Make sure your function is not "styled" in any way and is part of the expression

```
[entry.incidentSummary.replaceCRLFWithBR]
```

Or just put on the same place where this a**ConfiForms Field** macro

![Screenshot 2022-12-12 at 17.43.02.png](https://community.atlassian.com/t5/image/serverpage/image-id/230134iA2AD4D61F9259688/image-size/large?v=v2&px=999 "Screenshot 2022-12-12 at 17.43.02.png")

Alex


author: Markisio
body: Thanks, so odd that I put it back to my original and worked, thanks for your help I have applied your suggestion which \[entry.incidentSummary.replaceCRLFWithBR\] within IFTTT Integration Rules.

I swear I had that before and didn't work based on your original suggestion :)

thanks again!


author: Alex Medved _ConfiForms_
body: It could be the Confluence editor has inserted some invisible garbage like \<span\> tags or something

This happens sometime, so this is very important to have your expressions either written somewhere else (like atom editor or notepad) and then copy and pasted into the editor or written very accurately directly in the editor

Or... as an alternative I am pushing here all the time - just use the ConfiForms Field macros. They do it for you.. automatically, no need to access raw field values in the email templates and then transforming them with virtual functions


Tags: confiforms

confluence-server

server