Table of Contents |
---|
Introduction
Creating new notification or certificate templates has its challenges since rendering (code execution) is happening in a black box where debugging is difficult and no breakpoints possible.
...
Throwing explicit exceptions and checking variables whether an object lookup was successful would help with debugging and on live systems to look into issues.
Template for the certificate template:
Jira Legacy | ||||||
---|---|---|---|---|---|---|
|
Other (real world) examples can be found in Git Core
repository in
CustomerAssets\certificateTemplates
CustomerAssets\notificationTemplates
Example of a ‘Bad’ Template
...
Always check if the requested object does exist - check for null. If an object was expected and is required for rendering throw an explicit error with as much detail as possible so debugging and live-site-investigations is easier.
Develop Print Layout
Chrome has the ability to render a print version of a page instead of needing to open the print menu to see the print layout. This could reduce dev time for the print version.
Open Chrome
> Dev Tools
(F11)-> three dots
-> More tools
-> Rendering
-> emulate CSS media type
...
Set page size to whatever page you need to print:
...
Testing Print Layout
The preceding Dev Tools printing emulation should be viewed with caution. There are still many bugs with the tool as of this writing (Feb 2023). For example: print margins and positions are not accurately reflected when actually printing:
...
For this reason, any testing using this print emulation would be invalid. They should only be used for development.
Known Issues
Render Notification Template for Deleted Course
If a course gets deleted, the course name is not available anymore. Therefore, some notifications fail to get rendered because assembling the TVM dictionary entries fails. This is a known bug in GetAllTemplateParameters
.
This issue mainly happens for pre-expiry notifications IsCategory(Certificate,PreExpiry)
- see error below.
Error
Code Block |
---|
2024-10-27 17:00:10,343 [ERROR] {Email-NotificationChannel Thread} |NotificationManager.Impl.NotificationChannelEmail| *Core-Service-Lindblad* Service - Email-NotificationChannel: Unexpected exception for queue item Id = '9100852c-94bf-11ef-911f-ac1f6b46ac39'
System.NullReferenceException: Object reference not set to an instance of an object.
at MarineLMS.Model.Impl.CertificateNotification.GetAllTemplateParameters(TimeZoneInfo targetTimeZone)
at MarineLMS.NotificationManager.Impl.NotificationChannelEmail.AppendTemplateParametersFromTarget(ICoreUnitofWork uow, IChannelQueueItem item, String emailTo)
at MarineLMS.NotificationManager.Impl.NotificationChannelEmail.DeliverItem(ICoreUnitofWork uow, IChannelQueueItem item)
2024-10-27 17:00:10,359 [ERROR] {Email-NotificationChannel Thread} |NotificationManager.Impl.NotificationChannelEmail| *Core-Service-Lindblad* Service - Email-NotificationChannel: Unexpected exception for queue item Id = '9100852e-94bf-11ef-911f-ac1f6b46ac39'
System.NullReferenceException: Object reference not set to an instance of an object.
at MarineLMS.Model.Impl.CertificateNotification.GetAllTemplateParameters(TimeZoneInfo targetTimeZone)
at MarineLMS.NotificationManager.Impl.NotificationChannelEmail.AppendTemplateParametersFromTarget(ICoreUnitofWork uow, IChannelQueueItem item, String emailTo)
at MarineLMS.NotificationManager.Impl.NotificationChannelEmail.DeliverItem(ICoreUnitofWork uow, IChannelQueueItem item) |
Workaround
Ignore the error because the pre-expiry notification should not be sent.
Related Documents
Certificate Template Resource Structure using File Collections
Workflow to Release Certificate Template Files