web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Line Break in x++

(0) ShareShare
ReportReport
Posted on by 384

Dear experts,

i am trying to create a new line between a concatenated string field, the string value is below

 body ="Dear "  Hcmworker.name()  ",\r\n" 
 " ASDGDFDHDFG for the month of " mthName(mthOfYr(AAA.DATE)) "-" int2Str(year(AAA.DATE))
 " is attached to this e-mail\r\n"
 "ASAERGEGRGEGRTGRTGTG.\r\n"
 "3ADASDGDFGDFHDA ADASDFGR EGWEFWEFWEFWE.\r\n"
 "GERGERG ERGEGERGw rg egrqerg g erg eg eASD afegt"

it's an email template but its not working,

kindly assist.

regards,

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Line Break in x++

    Try to use \\r and \\n.

    If it still doesn't work, could you share any additional details about the outcome? Thanks!

  • sylvesterPowerBi Profile Picture
    384 on at
    RE: Line Break in x++
    [quote

    Try to use \\r and \\n.

    If it still doesn't work, could you share any additional details about the outcome? Thanks!

    [/quote

    using \\n and \\r didn't work, the outcome is the same but now \n and \r are showing in the text like below,  and before using\\n \\r it was the same but without showing \n and \r

    body =Dear Hcmworker.name(),\r\n ASDGDFDHDFG for the month of  Jan -2020 is attached to this e-mail\r\n ASAERGEGRGEGRTGRTGTG.\r\n 3ADASDGDFGDFHDA ADASDFGR EGWEFWEFWEFWE.\r\nGERGERG ERGEGERGw rg egrqerg g erg eg eASD afegt
     

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Line Break in x++

    Try to run the body variable through strFmtLB() function.

  • sylvesterPowerBi Profile Picture
    384 on at
    RE: Line Break in x++

    i got the same result but the \n are disappeared

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Line Break in x++

    Did you verify it all the way to sending email? Or did you just try to print it to infolog? Infolog always shows the string as one line of text. For example, if you check LogisticsPostalAddress.Address field on a form, it has multiple lines. But if you print it to infolog, it's shown as one line.

  • sylvesterPowerBi Profile Picture
    384 on at
    RE: Line Break in x++

    yes, im verifing it in the email not from infolog,

    i tried it in 2 different ways 1-StrFrmtLB(body) 2-body=StrFrmtLB("my text here") with no luck

    both gave the same result

    its weird since i used \n before and it was working well

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Line Break in x++

    What is the extended data type of "body" variable? In standard email templates it's using SysEmailContents data type.

  • sylvesterPowerBi Profile Picture
    384 on at
    RE: Line Break in x++

    body is a string field

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at
    RE: Line Break in x++

    Hi Silvester,

    Do you see if the e-mail comes in plain text or HTML? For html, you need to use <br> tag for new line

  • Gunjan Bhattachayya Profile Picture
    35,423 on at
    RE: Line Break in x++

    Hi Sylvester,

    Outlook normally uses HTML. Please try with "<br>" tag as Sergei suggested.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,850

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 795 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 519 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans