Thanks Pat!! I think in the past I was trying to use escape json and \n in different places than where you put them in your example, and so I never got it to work! I did exactly as you did and that finally worked for me! I'm excited! Time to go rearrange my DREL documents... :)
DREL test:
#c[escapeJson]
{
"body" : {
"messageSegments" : [
{
"type" : "Text",
"text" : "Site Assessment complete\nFirst Line: %a[chatter 1]. \nSecond Line: %a[chatter 2].\nThird Line: %a[chatter 3]"
}]
},
"feedElementType" : "FeedItem",
"subjectId" : "%a[IdWorkOrder]"
}
Chatter post:
------------------------------
Lisa Zido
Technical Systems Analyst
GOJO Industries Inc.
OH
------------------------------
Original Message:
Sent: 10-17-2022 17:40
From: Pat Cooney
Subject: DREL New line?
Hi Lisa, I believe you just need to escape the new line character, which you can do by including the following property: [#escapeDocumentFormat] where DocumentFormat is either Json, Xml, Html, Csv or Url.
So for what you provided there you would want your DREL Template to look like this
#c[escapeJson]{ "body": { "message": [{ "type": "Text", "text": "Site Assessment Complete\nSoap: %a[C_SoapTotal].\nSanitizer: %a[C_SanitizerTotal]...etc" }] },}
I obviously didn't put the line breaks in my example in the same spot as what you were asking for in your formatting, nor did I type out your full text string, but I think you get the idea.
The full documentation on how to escape special characters in DREL is in our product documentation, which you can find here: https://docs.prontoforms.com/1374411/Content/IntegrateWithOtherSystems/EscapeDRELFreemarkerHandlebarsOutput.htm?Highlight=escape%20characters
------------------------------
Pat Cooney
Community Engineer
ProntoForms
community@prontoforms.com
Original Message:
Sent: 10-17-2022 15:30
From: Lisa Zido
Subject: DREL New line?
Hi everyone! I was wondering if anyone has knowledge on how to create a new line (enter) in a DREL document? I keep thinking this should be super simple but everything I have tried hasn't worked. Here is my situation: We use the DREL document to create a chatter message in Salesforce on the Work Order record. In the example below, the chatter message will say the totals of the dispensers, plus total rooms. I would like to separate Campus Total Dispensers and Total Rooms onto a new line for ease of viewing. Right now, the post looks like this:
"End User Site Assessment Complete: Soap: 10. Sanitizer: 15. Lotion: 0. Shower: 0. Campus Dispenser Total: 0. Total Rooms: 0."
I would like the chatter post to look like this instead:
"End User Site Assessment Complete:
Soap: 10. Sanitizer: 15. Lotion: 0. Shower: 0.
Campus Dispenser Total: 0.
Total Rooms: 0."
Any ideas? I have tried \n with no success.
Thanks!
------------------------------
Lisa Zido
Technical Systems Analyst
GOJO Industries Inc.
OH
------------------------------