
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2020 10:58 PM
Is it possible to read System properties from email layout?
We would like to read ie. fonts and notification colors from system properties instead of hardcoding those to the email layout. I haven't figured out a way to access system properties from email layouts, is there a way?
Here is example:
<td style=" padding: 15px 0px 0px 0px; text-align: left; font-family: Helvetica,Arial,sans-serif; color:#323232;">
${notification:body}
</td>
We would like to define the font-family and the color in sys_properties, so we could re use the same values and upate all at once if there is any changes.
Solved! Go to Solution.
- Labels:
-
Notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2020 11:39 PM
Hi,
- Add <p>${mail_script:notification_email.styles}</p>.
- Navigate to System Notification > Email > Notifications Email Scripts.
- Click New: "Notification_email.styles"
- On the your email script:
var stylesheet = new GlideRecord ('sp_css');
stylesheet.get('name','company_email_notifications.css'); //Stylesheet for email styling
template.print('<div><style>' + stylesheet.css + '</style></div>');
3. Navigate to System Notification > Email > Notifications.
4. Open the email notification record that should use the template.
5. Navigate to the What it will contain section.
6. From the Email Template field, select the appropriate template.
7. Click Update.
Please mark correct or helpful if this helps.
Thanks
Swapnil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2020 11:11 PM
We can use OOB Layout option that is available for Emails. Lok for System Policy >> Email >> Layouts. Create one with required HTML data & then use the layout in the notifications.
Thanks,
Jaspal Singh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2020 11:28 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2020 11:39 PM
Hi,
- Add <p>${mail_script:notification_email.styles}</p>.
- Navigate to System Notification > Email > Notifications Email Scripts.
- Click New: "Notification_email.styles"
- On the your email script:
var stylesheet = new GlideRecord ('sp_css');
stylesheet.get('name','company_email_notifications.css'); //Stylesheet for email styling
template.print('<div><style>' + stylesheet.css + '</style></div>');
3. Navigate to System Notification > Email > Notifications.
4. Open the email notification record that should use the template.
5. Navigate to the What it will contain section.
6. From the Email Template field, select the appropriate template.
7. Click Update.
Please mark correct or helpful if this helps.
Thanks
Swapnil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 12:01 AM
Thank you! This solved my first issue!
Followup question:
I want to use CSS also inside of email script.
Instead of:
template.print('<style>.customer_button { font-family:"chevin-light", Helvetica,Arial,sans-serif; background-color: #FF6A10; border: none; color: white; padding: 10px 30px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; font-weight:bold; } .customer_button:hover { background-color: #ddd; color: black; }</style>');
template.print('<a href="'+link+'" class="customer_button">Button</a>');
I would like to use something like this:
var stylesheet = new GlideRecord('sp_css');
stylesheet.get('name', 'customer_email_notifications.css'); //Stylesheet for email styling
template.print('<div><style>' + stylesheet.css + '</style></div>');
template.print('<a href="'+link+'" class="customer_button">Button</a>');
But this doesn't work like this, what would be correct syntax?
We have several email notification for multiple modules and these all share one layout. Each email is then built from different email scripts which will bring all the information to the ticket, so we would need to be able to use css also inside of email script.