New Line is not functioning within For Each Loop

We have an email that is sent at the completion of our workflow and within that email all of the values being used as Defaults are to be displayed. I am able to get all of the necessary information detailed in the email itself; however, I want each default value on its own line. The first two (Marital Status and Occupation) show on their own lines, but everything following Date Reported stays within the same line. I have included screenshots from the process and email that is received. Any recommendations?

ForEach SendEmail

@jschuckmann

Can you show the whole content of the email body ? Because what the screenshot shows, just the content up to “Defaults used:” …

The screenshot from the email shows all of the values. I’ll copy/paste here:

ECF ID: 2005119883

Defaults used:
Marital Status: Single
Occupation: Employee
Date Reported To Insurer: 09/02/2016 12:25 PM Clee Code: 00000 FingersToes Injured: 1 - index finger or first toe Lost Time from Work: No

1 Like

@jschuckmann

I mean the code… so that i see what you missed

I believe the boxes that are showing “on top” of the screenshot itself is reflecting the code you are looking for. So the first being: string.Concat(emailBody, item.Key.ToString + ": " + item.Value + Environment.NewLine)

1 Like

@jschuckmann

I’m not sure what’s the issue! Is this what you are looking for ?

"ECF ID:" + "TEXT" + Environment.NewLine + Environment.NewLine + "Defaults used:" + "TEXT" + Environment.NewLine + "Marital Status:" + "TEXT" + Environment.NewLine + "Occupation:" + "TEXT" + Environment.NewLine + "Date Reported To Insurer:" + "TEXT " + Environment.NewLine + "Clee Code:" +"TEXT" + Environment.NewLine + "FingersToes Injured:" + "TEXT" + Environment.NewLine + "Lost Time From Work:" + "TEXT"

Ideally, yes. That is what I would like the outcome to be, but the items following the Defaults Used: vary for each run. So that is why I have the For Each loop, to gather all of those details from the DefaultedFields that were specifically used for that item. I’m not understanding why it seems to work as the Marital Status and Occupation are part of the defaultedFields and are showing on their own lines. Everything following the Data Reported to Insurer winds up on the same line though.

if body is html then newline wont work, you will need <br>

1 Like

@jschuckmann

It’s hard to figure out the issue here, but i think you just forgot to add “Environment.NewLine” somewhere… Try see each part of the code what shows, you might figure out what you missed !

@bcorrea

But the first lines, apears fine…

yes i just saw that in the comment bellow :slight_smile: it really looks that some newlines were forgotten.

I’ve been staring at it all day, inserting Environment.NewLine in other places, and also switched to html and tried
with no success. Any chance that the date could be causing an issue? It only seems to break at that line.

I should add that if I insert another NewLine at the end it double spaces everything with no issue.

@jschuckmann

Take of everything after date, add just a static string with the same part of the code, and than on the other part of the code static string.

It seems something missed in that part !

Can you give me an example? I’m sorry I don’t quite understand.

You are saying that after date you have and issue, what i suggest that you take off everything comes after date and newline after “date”, so that you see if it has something to do with that part of the code or what comes after

ECF ID: 2005119883

Defaults used:
Marital Status: Single
Occupation: Employee
Date Reported To Insurer: 09/02/2016 12:25 PM + Envirronment.NewLine + "TEST"

How would I do that when it is being automatically generated by the For Each activity since it is coming from the defaultedFields?

Date Reported To Insurer: 09/02/2016 12:25 PM + Envirronment.NewLine + “TEST”

The date is dynamic it’s in a variable right ?

This is where the date is input into the dictionary. Someone else built this and I am trying to make an update.

I’m sorry, i don’t know what is the issue. Maybe the guys on the forum might know better.

1 Like

No worries, thank you for looking at it!

1 Like