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.

How to adjust table borders in notification

Sironi
Kilo Sage

Hi All,

Please let me know how to adjust Table borders in notification

 

Sironi_0-1714865451623.png

template.print("<table border='1px solid black'>");
    var gr = new GlideRecord('incident');
    gr.addQuery('sys_id', current.sys_id.toString());
    gr.query();
    if (gr.next()) {
        template.print("<tr><td> Number </td><td>" + gr.number.toString() + "</td></tr>");
        template.print("<tr><td> Category </td><td>" + gr.category.toString() + "</td></tr>");
    }
    template.print("</table>");

 

Expecting Table format like below, can we make any changes to get it.

NumberINC0009003
CategoryInquiry




1 ACCEPTED SOLUTION

HI @Sironi 

Can you check with this

template.print("<style>table { border-collapse: collapse; } table.outer { border: 10px solid black; } table, th, td { border: 1px solid black; }</style>");

template.print("<table class='outer'>");

 

Mark it Helpful and Accept Solution!! If this helps you to understand.

View solution in original post

12 REPLIES 12

it is working 

 template.print("<style>table { border-collapse: collapse; } table.outer { border: 5px solid black; } table, th, td { border: 1px solid black; }</style>");
    template.print("<table class='outer'>");
   // template.print("<table>"); // deactivated this line

    var gr = new GlideRecord('incident');
    gr.addQuery('sys_id', current.sys_id.toString());
    gr.query();
    if (gr.next()) {
        template.print("<tr><td> Number </td><td>" + gr.number.toString() + "</td></tr>");
        template.print("<tr><td> Category </td><td>" + gr.category.toString() + "</td></tr>");
    }
    template.print("</table>");

Sironi_0-1714888070460.png

 



Nice ! Can you mark it Helpful and Accept Solutions it would be helpful for other Members.

Thanks a lot for your help.