Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add work notes on SNOW Incidents with html tags using SNOW API

Naresh Kumar Gn
Giga Contributor

Hi All,

I am using SNOW API to create and update SNOW incident. I can update work notes manually using GUI as well using API, but when I tried the same using HTML tag for table example given below, manually using GUI it works, but using API when doing the same update under work notes it does not create a table instead it adds as a string.

<table>
  <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Mexico</td>
  </tr>
  <tr>
    <td>Ernst Handel</td>
    <td>Roland Mendel</td>
    <td>Austria</td>
  </tr>
  <tr>
    <td>Island Trading</td>
    <td>Helen Bennett</td>
    <td>UK</td>
  </tr>
  <tr>
    <td>Laughing Bacchus Winecellars</td>
    <td>Yoshi Tannamuri</td>
    <td>Canada</td>
  </tr>
  <tr>
    <td>Magazzini Alimentari Riuniti</td>
    <td>Giovanni Rovelli</td>
    <td>Italy</td>
  </tr>
</table>

 

Sample screenshot attached below,

Manual update:

find_real_file.png

 

Update using API.

 

find_real_file.png

 

How to overcome this using SNOW API update to work notes. Please help.

 

Regards,

Naresh

1 ACCEPTED SOLUTION

Tushar Walveka2
Tera Guru

Case 1 : Update using work notes

find_real_file.png

 Case 2 : Update using API

find_real_file.png

Result : Both ways it will work

find_real_file.png

View solution in original post

12 REPLIES 12

Uncle Rob
Kilo Patron

 

Try this...

[code]

   //your HTML

[/code]

I tried but same results. It is not creating the table.

The input to work notes "[code]<table border='1'> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>`$100</td> </tr> <tr> <td>February</td> <td>`$80</td> </tr> </table>[/code]"

 

find_real_file.png

It is possible execute Javascript inside a worknote?

I can see running javascript to POPULATE a worknote, but I wouldn't ever EXECUTE javascript from a worknote.