Script - Multiline object line break in participant data

Hi all,

I am working on a process automation for our agents that takes a multiline note from the agent and stores it to participant data. My automation triggers off user.end and then uses this data (among other things, including the wrap code).

The automation works great, but I am noticing in my participant data that the line breaks from the multiline are not appearing in my saved participant data.

I am using an escaped DA for this to post to participant data, using the multiline note {{interactionNote}} as the field. I noted that without using $esc.jsonString for this, the write to participant data fails. Now, the note data is present.

However, in the participant data, I do not see anything that appears to be present for a line break, such as \n. I didn't expect a new line to be created, but did expect I would see something indicating an escaped character. This is with using enter in the multiline box, as an agent would for this usage.

Example:
"Testing Notes with escaped line breaks.

Test test test."

Particpant Data: Testing Notes with escaped line breaks. Test test test.

API I'm using: /api/v2/conversations/calls/${input.conversationId}/participants/${input.participantId}/attributes

Body:

{
"attributes": {
"interactionNote": "$esc.jsonString(${input.interactionNote})"
}
}

Based on Convert line break to \n in data action in Script This does work directly to a data action. Our design would not be able to account for that (outside of the participant data action I created) because of another limitation I am running into with wrap codes, which I need for some reporting around this project (posting a wrap code via the API does not allow me to disallow the agent from changing the wrap code, unless I remove provisional, which then cancels their ACW on call completion)

I'm looking to try and figure out one of the following:

  • Will an escaped string with line breaks from a multiline input properly introduce those values to participant data?
  • If not, is there a way to disable the wrap code selection in after-call work without forcing mandatory, no early exit?
1 Like

Looks like what I needed was a fresh set of eyes - I opened up the conversation details and I do see my line breaks in the participant data.

I suppose this also means, if I need to, I can replace instances of \n with \r or another break mechanism using my architect flow using replace. I think I am set.

Try to replace your line breaks with double backslash for example \n to be \\n

2 Likes

I thought I had posted in here - this was the answer to complete my puzzle.

This made the \n show in the participant data within Genesys, and more importantly also solved my issue with line breaks on the other side of the call. The string was already escaped using esc.jsonString, then I had to double escape it again in order for the far end to recognize it.

Thanks!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.