- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 08:47 AM
I've got a BR to copy the cause, fix and workaround details from a Root Cause Analysis problem task to its parent problem when the task is closed.
The issue is that the first \n's that I output as part of the copy appear to be getting ignored. I've no idea why.
The code looks like this:
// Add your code here
var gr = new GlideRecord('problem');
gr.get(current.problem);
var task_start = ' \n\nNotes from Task ' + current.number + ': ' + current.short_description + ' follow:\n\n';
var task_end = '\n\n----------\n\n';
if (current.workaround != '') {
gr.workaround += task_start + current.workaround + task_end;
}
if (current.cause_notes != '') {
gr.cause_notes += task_start + current.cause_notes + task_end;
}
if (current.fix_notes != '') {
gr.fix_notes += task_start + current.fix_notes + task_end;
}
gr.update();
---------- Notes from Task PTASK0010028: Testng 10 follow:
Cause 10
---------- Notes from Task PTASK0010029: Testing 11 follow:
Cause 11
You can see where the new comment (starting 'Notes') runs straight on from the dashes, despite there being copious amounts of \n in play.
Does anyone have an ideas how I might get round this?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 09:17 AM
Hi @spike
The fields you are trying to update are HTML type fields in problem table
Issue - Using the escape character "\n" in an HTML field does not insert a new line (line feed) when rendering the content.
Resolution - Use the HTML tag "<br />" instead of the newline escape character
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 09:17 AM
Hi @spike
The fields you are trying to update are HTML type fields in problem table
Issue - Using the escape character "\n" in an HTML field does not insert a new line (line feed) when rendering the content.
Resolution - Use the HTML tag "<br />" instead of the newline escape character
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 01:14 AM
I was for some reason convinced that wasn't going to work. But it has. Many thanks!