- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2014 07:41 AM
Hi,
We have a mail script that is included in a notification. basically, it gathers all the approvals of a change request and displays them in a table with some data like last update date, etc.
we simply used template.print("<table>"); to achieve the table structure. But we need to "design" the table so it will look good.
i have tried using the style attribute in the table tag (like i would do in an email body. something like template.print("<table style="border: 1px solid #98bf21; padding: 3px 7px 2px 7px; background-color: #a7c942;">");
but when i check the syntax, i get an error that it is expecting a ) after the style=". i am guessing it is because it encounters a second ".
Is there a way to overcome this and use html style in mail scripts?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2014 08:37 AM
Thanks Tim,
Actually i did something a bit different, but it worked.
I did:
template.print('<table style="border: 1px solid #98bf21; padding: 3px 7px 2px 7px; background-color: #a7c942;">');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2014 08:10 AM
I think you need to escape the " characters. You probably don't need to use the second " anyways. Try this:
template.print("<table style=border: 1px solid #98bf21; padding: 3px 7px 2px 7px; background-color: #a7c942>");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2014 08:37 AM
Thanks Tim,
Actually i did something a bit different, but it worked.
I did:
template.print('<table style="border: 1px solid #98bf21; padding: 3px 7px 2px 7px; background-color: #a7c942;">');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2014 08:32 AM
Something I've done before is just called a script include and include all of the HTML formatting in that.
i.e.
<mail script>
mail = new htmlEmail();
template.print(mail.send(current.sys_id));
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2015 08:12 PM
I take it a step further and use CSS to keep the styling consistent and reduce the need to update a bunch of templates for a simple change.
Posted a howto here: Styles into your emails...