Email Templates
Submitted by Ben_Charlton on Fri, 18/03/2016 - 11:22
When selecting an email template in the Document Template Screen when I try to save the Template I get:
Failed to validate Active Start Time of Email Template: Active Start Time is required
THIS IS BASED On BUILD
git-svn-id: svn://localhost/openvpms/projects/openvpms/trunk@6944 9e4fa352-aafb-0310-9071-df624684024b
Re: Email Templates
Exposing the entitylink.documentTemplateEmail showed it wasnt being set. Setting it manually fixed the error.
Re: Email Templates
Version 6936 from svn populates the activeStartTime:
Where'd you get yours from?
Re: Email Templates
I think the issue is that when you did the migration for existing templates we didnt autopopulate the field
Re: Email Templates
You're right. On reflection, the activeStartTime node is not required.
I'll remove it.
Re: Email Templates
Additionally can you expand on the fields "SUBJECT SOURCE" and "CONTENT SOURCE"
Finally it may stream line things if people are able to edit the email Document Template via the documenttemplate selection box
ie
I am creating a new Document template and wish to select an email template. Currently I select the new template and then need to change my context to actually see what is in that template - it may help if we can open it directly after selection to edit it.
Finally can you elaborate on the content type - currently if I select DOCUMENT it asks me to upload a new file - I would have assumed to attached the generated document from the linked document template.
Re: Email Templates
This is covered in http://www.openvpms.org/documentation/csh/1.9/admin/template/email
The Subject Source and Content Source fields are optional. They are useful if you:
E.g., if you have an expression that uses the latest visit for a patient, you could set the Subject Source to:
and the Subject to:
If you select a Document for the content type, the document will be merged and inserted into the email as HTML.
I take your point about switching in and out of the Document Template editor to edit email templates. This is an issue with all objects that reference others (e.g. customers reference patients. To edit the patient you need to quit out of the customer editor). While it would be possible to support opening editors for related objects, cascading editors introduce their own issues:
Re: Email Templates
Re: Email Templates
Email templates are inserted into the body of the email as HTML, so there are restrictions on the type of documents that can be used. A Document Template doesn't restrict the content.
Re: Email Templates
So to clarify
The document uploaded into the email template is added as HTML to the outgoing mail?
The existing document that is linked is still attached and generated as it was before.
Re: Email Templates
Thats correct. You can verify this by adding an Email Template to the Invoice document template, and then mail an invoice. The subject and content of the mail will be populated, with the invoice as the attachment.
Re: Email Templates
It may be wise to add a xpath validator to the template edit form - similar to the one in the appointmentsmsreminder edit form. The problem with these expressions is they can be very long and because errors might be stored in the reminder error field ...they get cut off .. eg.
Failed to process reminder: Invalid XPath: 'concat(\' Hi \",\n$customer.name, \',\'$nl,\n expr:if(expr:var(\'$patient.name\') != \'\', concat(expr:var(\'$patient.name\'), \''s\'), \'Your Pet's\'),\n\' is old enough now to undergo surgical desexing.\', \n $nl,\n \'Sincerely\', \n$location.name,$nl,\nparty:getBillingAddress($location),$nl,\nparty:getTelephone($location),\')'. Syntax error after: 'c'
Re: Email Templates
So couple of things - I have sent you an error report with a "STATE" exception that occurs when trying to VIEW a email template with a document report attached.
I also would note that we need to update the Bootstrap to use the correct params
[DEBUG,OOBootstrapService,http-bio-8080-exec-8 - Ben] Attempting to connect, attempt 1 of 10 CE> Warning: -headless is deprecated. Use --headless instead. CE> Warning: -nodefault is deprecated. Use --nodefault instead. CE> Warning: -nofirststartwizard is deprecated. Use --nofirststartwizard instead. CE> Warning: -nolockcheck is deprecated. Use --nolockcheck instead. CE> Warning: -nologo is deprecated. Use --nologo instead. CE> Warning: -norestore is deprecated. Use --norestore instead. CE> Warning: -accept=socket,host=localhost,port=8100;urp; is deprecated. Use --accept=socket,host=localhost,port=8100;urp; instead. CE> Warning: -headless is deprecated. Use --headless instead. CE> Warning: -nodefault is deprecated. Use --nodefault instead. CE> Warning: -nofirststartwizard is deprecated. Use --nofirststartwizard instead. CE> Warning: -nolockcheck is deprecated. Use --nolockcheck instead. CE> Warning: -nologo is deprecated. Use --nologo instead. CE> Warning: -norestore is deprecated. Use --norestore instead. CE> Warning: -accept=socket,host=localhost,port=8100;urp; is deprecated. Use --accept=socket,host=localhost,port=8100;urp; instead.
Additionally I am not sure images should be passed via these templates I tried it ..Office embeds at as
Which doesnt render properly in GMAIL unless I "SHOW ORIGINAL MESSAGE" in which case it renders the image as blank... I think if you want to send images in an email template you may want them sent as a hyperlink with the files stored on a webserver somewhere....
I havent yet tried rendering in jrxml but given it normally links them doesnt embed them I would assume a similar outcome.