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

Hi @Sironi Increase the border Pixel make 2px or 3px according to your requirement .

 

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

I tried and  increased it to 5px, inside cells also getting become solid black, I don't want inside cells to be solid

Sironi_0-1714886406613.png

 

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

template.print("<table>");

 

Mark it Helpful and Accept Solution!! If this solves your issue.

sorry no luck

template.print("<style>table { border-collapse: collapse; border: 10px solid black; } table, th, td { border: 1px solid black; }</style>");
    template.print("<table>");
    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-1714887180866.png

 

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.