cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
buro2020
Helper II
Helper II

Preserve multi-line breaks in email message from a Sharepoint column

Hi all,

 

I have searched various answers on this subject, but none help my issue.

 

I have a workflow set up to send an email message which includes the name of a folder/hyperlink combo, and contains information as in who the folder relates too (another column in Sharepoint library).

 

I have a 3rd column which is called Notes. This field is used to add additional text. The field is set to multi-line, so in the Sharepoint Library it will look something like below:

buro2020_0-1605179581848.png

 

So when my automated flow runs, my email ends up looking like below:

buro2020_1-1605179694927.png

 

Basically, it does not preserve the line breaks. I would like it to preserve the line breaks, could someone guide me in setting it up please.

 

my flow below as it stands:

buro2020_2-1605179916453.png

flow2.JPGflow3.jpg

 

The fields are filled in btw, just white out.

 

any help would be great on this.

 

NB. I don't have full admin rights to Sharepoint at my organisation, so I am limited to being a normal user.

Also I am using Microsoft Power Automate for flow design and implementation and Sharepoint of Office 365.

6 REPLIES 6
Paulie78
Super User
Super User

I think the issue is that your email is HTML and your sharepoint text is plain text. Therefore the link breaks are newlines ( \n). 

 

So you need to do a replace and replace the new lines with html <br> in the email step. So it would be something like (and I am guessing a bit here).

replace(outputs('Get_File_Properties')['notes'], '\n', '<br>')

The '\n' might not do anything for you, sometimes it is easier to create a compose step called "newLine" and just enter a newline character into it. Then change the replace to something like:

replace(outputs('Get_File_Properties')['notes'], outputs('newLine'), '<br>')

 

But the concept should retain your line breaks, you might have to tweak a little bit. 

 

Hi Paulie,

 

Thanks, but neither worked even with tweaks, it wasn't recognising 'Notes' the column name and kept flagging errors. I tried compose and it did not like the name newLine, so had to tweak to accept Compose action to allow me to run the test and met with error message: 

 

error.JPG

 

I got invalid templates with various versions of the tweaked replace expression in the email body.

the \ n  did nothing as you said, something I am doing wrong somewhere.
Put the column notes does exist, and my previous flow worked in pulling the metadata from that column into an email, but take out my notes field in the email body and nothing works.

Paulie78
Super User
Super User

can you create a compose step, with just the notes in it, nothing else. Then run it, go into the run history and show me what comes up. 

Same as before. I have a feeling it is something to do with the get file properties part in the replace expression that might be causing it.

Paulie78
Super User
Super User

That's probably because I  made a typo. Try:

replace(outputs('Get_file_properties')['notes'], outputs('newLine'), '<br>')

But I could get the whole thing right first time if you would post the outputs of the "Get_file_properties" action and post it back here. You can blank out anything sensitive.

 

To get the outputs you need to go into the run history and find the outputs section of the get file properties action.

so this is the body of outputs from get properties 

 

{
"@odata.etag": "\"2\"",
"ItemInternalId": "",
"ID": ,
"Modified": "2020-11-11T17:22:17Z",
"Editor": {
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "i:0#.f|membership|",
"DisplayName": "",
"Email": "",
"Picture": "https://sharepoint.com/sites/15/UserPhoto.aspx?Size=L&AccountName=",
"Department": "PDM",
"JobTitle": ""
},
"Editor#Claims": "i:0#.f|membership|",
"Receivedfrom": "PMA-traffic",
"notes": "Please find attached the swept path analysis for the HS2. A bit tight passing some of the columns, but works. The column with the red cloud marking will need to be removed / moved. In and outbound movements are on layers ATR01 and ATR02 respectively.\n\nWith regards the sections you supplied, the height clearances for vehicles entering the basement car park are fine - 3.0m at the entrance to the ramp, 2.9m pinch point on the way down the ramp and 3.8m within the car park.,
"Created": "2020-11-11T17:21:47Z",
"Author": {
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "i:0#.f|membership|",
"DisplayName": "",
"Email": "",
"Picture": "https://sharepoint.com/sites/_layouts/15/UserPhoto.aspx?Size=L&AccountName=",
"Department": "PDM",
"JobTitle": ""
},
"Author#Claims": "i:0#.f|membership|",
"OData__DisplayName": "",
"{Identifier}": "03_Incoming%252fPMA-Traffic,
"{IsFolder}": true,
"{Thumbnail}": {
"Large": null,
"Medium": null,
"Small": null
},
"{Link}": "https://sharepoint.com/sites/03_Incoming/PMA-Traffic/,
"{Name}": "201030 Swept path analysis for the HS2",
"{FilenameWithExtension}": "201030 Swept path analysis for the HS2",
"{Path}": "03_Incoming/PMA-Traffic/",
"{FullPath}": "03_Incoming/PMA-Traffic/201030 Swept path analysis for the HS2",
"{ContentType}": {
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedContentType",
"Id": "",
"Name": "Folder"
},
"{ContentType}#Id": "",
"{IsCheckedOut}": false,
"{VersionNumber}": "1.1"
}

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,841)