How to set the records in table format

Sathwik1
Tera Expert

In continuation to this question  

https://community.servicenow.com/community?id=community_question&sys_id=7e3e79861be2cd50d018c8ca234bcb9c

I am getting output as "INC0000001RITM0010001"

but I am excepting output as..{table format}

  Number  
INC0000001
RITM0010001

@shloke04 can you please help?

1 ACCEPTED SOLUTION

shloke04
Kilo Patron

Hi @Sathwik 

As discussed in your last post , if you want to have it as a Tabular format then please update your last code which I helped you out with below code.

This will give you the details in Tabular Format

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    // Add your code here
    var getArray = event.parm1.toString();
    var splitStr = getArray.split(',');
    template.print('<table border="1">');
    for (var i = 0; i < splitStr.length; i++) {
        template.print("<tr>");
        template.print("<td>" + 'Number' + "</td>");
        template.print("<td>" + splitStr[i] + "</td>");
        template.print("</tr>");
    }
    template.print("</table>");

})(current, template, email, email_action, event);

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

5 REPLIES 5

shloke04
Kilo Patron

Hi @Sathwik 

As discussed in your last post , if you want to have it as a Tabular format then please update your last code which I helped you out with below code.

This will give you the details in Tabular Format

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    // Add your code here
    var getArray = event.parm1.toString();
    var splitStr = getArray.split(',');
    template.print('<table border="1">');
    for (var i = 0; i < splitStr.length; i++) {
        template.print("<tr>");
        template.print("<td>" + 'Number' + "</td>");
        template.print("<td>" + splitStr[i] + "</td>");
        template.print("</tr>");
    }
    template.print("</table>");

})(current, template, email, email_action, event);

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke