Email Templates

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     

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Email Templates

Exposing the entitylink.documentTemplateEmail showed it wasnt being set. Setting it manually fixed the error.

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Email Templates

Version 6936 from svn populates the activeStartTime:

<node name="activeStartTime" path="/activeStartTime" type="java.util.Date" minCardinality="1"
      hidden="true" defaultValue="java.util.Date.new()"/>

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

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

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.

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

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:

  • have a complex xpath expression where the same object is referred to more than once.
    E.g., if you have an expression that uses the latest visit for a patient, you could set the Subject Source to:
party:getPatientVisit($patient)

and the Subject to:

concat('Regarding ',$patient.name, 's visit on ', date:formatDate(/activityStartTime), ' for ', openvpms:lookup(., 'reason'))

 

  • have generic macros or JasperReport templates and you need to select the object to report on

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:

  • editing cycles can occur (e.g. edit object A, edit related object B, edit related object A). This can occur at present, when creating a new patient for a customer.
  • greater resource utilisation

 

 

Re: Email Templates

If you select a Document for the content type, the document will be merged and inserted into the email as HTML.

This is the only part I am not sure I understand - Emailtemplates are linked directly to documenttemplates - which one assumes have a document associated with them...Why do we need to upload another template document to the email template?

Why not just have the email look for the associated documenttemplate.

AttachmentSize
emailtemplate.PNG 15.18 KB
Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

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.

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

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\'), \'&apos;s\'), \'Your Pet&apos;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'

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

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.
/**
 * Default arguments to supply to OpenOffice.
 * From https://wiki.openoffice.org/wiki/Framework/Article/Command_Line_Arguments <-- Outdated
 */
private static List<String> DEFAULT_ARGS = Arrays.asList(
        "-nodefault",            // Don't start with an empty document.
        "-nofirststartwizard",   // Don't show the first start wizard on the first start
        "-nolockcheck",          // Don't check for remote instances using a .lock file in the user folder.
        "-nologo",               // Don't show the splash screen.
        "-norestore"             // Suppress restart/restore after a fatal error.
);

/**
 * The logger.
 */

Additionally I am not sure images should be passed via these templates I tried it ..Office embeds at as

 <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDA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o2cy46KgAAAAAQ1TuPOsbdW90e8aVCwAB8+UmrL9r9mytbBvUAABAz1azvVZyDsHN1W8dvEBy6Osdcjhkeo0q6Oj6J2AAAV2Z5jGOpcslpV9iegAAAAAB59DkeKxVyOHrefDmntBLQ887jLDc1oVCdwAAAAAAAAAAAAAAAAAAAAAAAAAAAHn0OVaVgr8cHRpyrWmewFwAAELNVpShEvXjtk/4927QWAAAAAAAAxcj61ySOaV6byzqawTuAAAAAB8qVqrGWlrGuYCqTcblpPZDXMAYxWfFmy0wbxpmEgAAAAAAAAAEJN1ylq10jnXRc9Q3wiOc3OmYW2Oqc+6FaA1gAAAAADS5103k+Nrbs2Cl2i9oaZvASfPNKq+bmW0Vmgy9ZtlZsI2qAAAply5zjtr2esXbHWZ

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.

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au
Syndicate content