/n is not accepting in work notes for outbound integration

Balakrishna_ABK
Tera Guru

we are passing caller_id and caller email id in worknotes of incident. we are getting desired output in single line however if we try to show in next line its throwing error

 

var work_notes = current.work_notes.getJournalEntry(1);
var callerName = current.caller_id.getDisplayValue() ;
var callerEmail = current.caller_id.email.getDisplayValue() ;

var notes = "Caller Details:\n" +
"Name: " + callerName + "\n" +
"Email ID: " + callerEmail + "\n" +
"Work Notes: " + work_notes;

r.setStringParameter('work_notes', notes);

1 ACCEPTED SOLUTION

SAI VENKATESH
Tera Sage
Tera Sage

Hi @Balakrishna_ABK 

 

You can try the below script 

 

var work_notes = current.work_notes.getJournalEntry(1);
var callerName = current.caller_id.getDisplayValue();
var callerEmail = current.caller_id.email.getDisplayValue();

var notes = "Caller Details:\n" +
"Name: " + callerName + "\n" +
"Email ID: " + callerEmail + "\n" +
"Work Notes: " + work_notes;
notes = notes.replace(/\n/g, '\\n');
r.setStringParameter('work_notes', notes);

 

Thanks and Regards

Sai Venkatesh

View solution in original post

4 REPLIES 4

SAI VENKATESH
Tera Sage
Tera Sage

Hi @Balakrishna_ABK 

 

You can try the below script 

 

var work_notes = current.work_notes.getJournalEntry(1);
var callerName = current.caller_id.getDisplayValue();
var callerEmail = current.caller_id.email.getDisplayValue();

var notes = "Caller Details:\n" +
"Name: " + callerName + "\n" +
"Email ID: " + callerEmail + "\n" +
"Work Notes: " + work_notes;
notes = notes.replace(/\n/g, '\\n');
r.setStringParameter('work_notes', notes);

 

Thanks and Regards

Sai Venkatesh

Hi @SAI VENKATESH , thanks for the quick reply its working.

Hi @SAI VENKATESH ,

when we are trying to use below code for special characters its again coming in same line

 

var notes = "Caller Details:\\n" +
            "Name: " + callerName + "\\n" +
            "Email ID: " + callerEmail + "\\n" +
            "Work Notes: " + work_notes;
        notes = notes.replace(/\n/g, '\\n');
        notes = notes.replace(/(?:\r\n|\r|\n)/g, '');
        notes = notes.replace(/(?:\t)/g, '\\t');
        notes = notes.replace(/&/g, '&');
        notes = notes.replace(/"/g, '\\');
        notes = notes.replace(/(?:((\\\\)*)\\)(?![\\/{])/g, '\\\\');
        r.setStringParameterNoEscape('work_notes', notes);

Anurag Tripathi
Mega Patron
Mega Patron

When you populate the work_notes add the data in this tag, it will work then

[code] [/code]

 

something like below

var work_notes = current.work_notes.getJournalEntry(1);
var callerName = current.caller_id.getDisplayValue() ;
var callerEmail = current.caller_id.email.getDisplayValue() ;

var notes = "[code]Caller Details:\n" +
"Name: " + callerName + "\n" +
"Email ID: " + callerEmail + "\n" +
"Work Notes: " + work_notes + "[/code]";

r.setStringParameter('work_notes', notes);

 

-Anurag