Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Done
-
None
-
None
-
None
-
DevTools 55
-
1
Description
To reproduce:
- Set up any scripted item that sends custom emails (event handler, job, etc.)
- In the Configuration script, add a binding to the config map.
- Refer to that binding in the subject/body template.
- Trigger the item.
Expected: The bound value in config is included in the subject/body of the email.
Actual: The item throws an exception from within the template because it can't find the binding.
In order to permit manipulation of the MailMessage.Builder object in the Configuration script, it is constructed and fully built out before being passed into the script. This includes rendering the subject and body templates. However, users are supposed to be able to refer to the contents of the config map in those templates, and are advised to use the Configuration script to populate this map, despite the fact that it will do so too late to have any effect.
One fix would be to populate most of the builder's fields before running the Configuration script, but leave the subject and body until afterwards when the config map is available. This would however have the downside of not allowing programmatic alteration of those fields.
The user workarounds for the time being are either to populate config in the Condition script instead, or to set the subject and body fields programmatically in the Configuration script and not use the template fields at all.