diff --git a/src/adapters/netsuite/index.js b/src/adapters/netsuite/index.js index f3a26682..d3bb153a 100644 --- a/src/adapters/netsuite/index.js +++ b/src/adapters/netsuite/index.js @@ -788,7 +788,7 @@ function upsertCallAgentNote({ body, note }) { } const noteRegex = /^- Note:[^\n]*(?:\n(?!- ).*)*/m; if (noteRegex.test(body)) { - body = body.replace(noteRegex, `- Note: ${note}\n`); + body = body.replace(noteRegex, `- Note: ${note}`); } else { if (body && !body.endsWith('\n')) { @@ -812,7 +812,7 @@ function upsertCallResult({ body, result }) { function upsertCallDuration({ body, duration }) { const durationRegex = /- Duration: (.+?)(?=\n|$)/g; if (durationRegex.test(body)) { - body = body.replace(durationRegex, `- Duration: ${secondsToHoursMinutesSeconds(duration)}\n`); + body = body.replace(durationRegex, `- Duration: ${secondsToHoursMinutesSeconds(duration)}`); } else { body += `- Duration: ${secondsToHoursMinutesSeconds(duration)}\n`; } @@ -830,9 +830,9 @@ function upsertContactPhoneNumber({ body, phoneNumber, direction }) { } function upsertCallRecording({ body, recordingLink }) { - const recordingLinkRegex = RegExp('- Call recording link: (.+?)\n'); + const recordingLinkRegex = /- Call recording link: (.+?)(?=\n|$)/g; if (!!recordingLink && recordingLinkRegex.test(body)) { - body = body.replace(recordingLinkRegex, `- Call recording link: ${recordingLink}\n`); + body = body.replace(recordingLinkRegex, `- Call recording link: ${recordingLink}`); } else if (!!recordingLink) { // if not end with new line, add new line if (body && !body.endsWith('\n')) {