How to align table in email script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2023 04:33 AM
Hi everyone,
I want to align table in email script with header and values for certain field.
I have written email script, I am getting data but alignment is not proper. could anyone give a solution.
email script:
For Header
if (tableName == "cmdb_ci_service_discovered") {
template.print("<style>table{width:100%;border-collapse:collapse;} th{border:1px solid black;font-family:Arial;font-size:11pt;padding:20px;}, td</style><table><tr><th width=20%>Application Service Number</th><th width=20%>Name</th><th width=20%>Accountable Owner</th><th width=20%>Managed by</th><th width=20%>Accountable Remediation Owner</th><th width=20%>ARO Backup</th><th width=20%>ARO governance</th></tr></table>");
For values:
if (tableName == "cmdb_ci_service_discovered") {
template.print("<html><style>table{font-family: arial, sans-serif;border collapse: collapse;width: 100%;}td,th{border: 1px solid;text-align: left;padding: 8px;}</style><body><table><tr><td width=20%> " + gr.number + " </td><td width=20%> " + gr.name + " </td><td width=20%> " + gr.assigned_to.getDisplayValue() + " </td><td width=20%> " + gr.managed_by.getDisplayValue() + " </td><td width=20%> " + gr.u_accountable_remediation_owner.getDisplayValue() + " </td><td width=20%> " + gr.u_aro_backup.getDisplayValue() + "</td><td width=20%> " + gr.u_aro_governance.getDisplayValue() +
" </td></tr></table></body></html>");
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2023 02:06 PM - edited ‎02-10-2023 02:12 PM
Have you thought that just adding the fields and not using a table might look cleaner and more simple to execute?
Email Notification Header
Application Service Number:
Name:
Accountable Owner:
Managed by:
Accountable Remediation Owner:
ARO Backup:
ARO Governance:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2023 01:20 AM
You are adding as many tables as records + 1. While it would be possible to make all of those the same width, it is next to impossible to make columns within those the same with.
But the solution is simple: add just one table.