Worknotes need to support tabular format?

srinathgtrk
Tera Contributor

Hi Everyone,

 

I have one requirement from client work notes needs to be support tabular format like as below.

SNONameEmp nopercentage
1Raj2480
2san2590

But as per out of the box functionalities it is supporting like this below.

srinathgtrk_0-1685022761804.png

Thanks,

Srinath

7 REPLIES 7

Karan Chhabra6
Mega Sage
Mega Sage

Hi @srinathgtrk ,

 

This thread should help you with your requirement: https://www.servicenow.com/community/developer-forum/want-work-notes-display-in-tabular-format/m-p/2...

 

You need to wrap your content in code blocks [code]..........[/code] in order to display a table into worknotes.

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks!

Riya Verma
Kilo Sage
Kilo Sage

Hi @srinathgtrk ,

 

Hope you are doing great.

 

Please find below code to create a simple table structure within the work notes field for reference:

 

function addTableToWorkNotes() {
  var tableName = "<table>";
  
  // Add table headers
  tableName += "<tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>";
  
  // Add table rows and data
  tableName += "<tr><td>Data 1</td><td>Data 2</td><td>Data 3</td></tr>";
  tableName += "<tr><td>Data 4</td><td>Data 5</td><td>Data 6</td></tr>";
  
  tableName += "</table>";
  
  // Append the table to the existing work notes field
  var currentWorkNotes = g_form.getValue('work_notes');
  var updatedWorkNotes = currentWorkNotes + "<br>" + tableName;
  
  // Set the updated work notes value
  g_form.setValue('work_notes', updatedWorkNotes);
}

you can customize the table structure, column names, and data as per your specific requirements.

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Hi @srinathgtrk ,

You can also refer following link too for reference :  Formatting within Journal fields using HTML & [code]

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Apart from this html format is there any other way for tabular format support?

 

Thanks,

Srinath.