Page 1 of 1

Retrieving and Parsing Email Templates in Code

PostPosted: Mon Apr 01, 2019 8:31 pm
by pricerc
I'd like to hijack sales order email templates for my own nefarious purposes.

I've found
Code: Select all
JiwaFinancials.Jiwa.JiwaEmailTemplates.EmailTemplate
in my object browser, but I'm not seeing a method for applying a template to a SalesOrder.

Is there something public, or do I need to roll my own?

Re: Retrieving and Parsing Email Templates in Code  Topic is solved

PostPosted: Thu Apr 04, 2019 11:38 am
by Mike.Sheen
That is a project we were never given the time to finish.

We aim was to have a unified email template for use everywhere that sends emails - including sales orders, similar to what we have for Creditor Cheque Payment Email Templates - with a HTML preview and other such fanciness.

So, yes you'll need to roll your own.

Re: Retrieving and Parsing Email Templates in Code

PostPosted: Thu Apr 04, 2019 11:44 am
by pricerc
Mike.Sheen wrote:That is a project we were never given the time to finish.

We aim was to have a unified email template for use everywhere that sends emails - including sales orders, similar to what we have for Creditor Cheque Payment Email Templates - with a HTML preview and other such fanciness.

So, yes you'll need to roll your own.


Cool. I already started.

But instead of your pre-defined list of fields, I'm making use of FormatWith from James Newton-King (of JSON.NET fame); a very simple but effective regex-based thing that I started using way back, way before interpolated strings, that uses format strings that look a bit like interpolated strings. http://james.newtonking.com/archive/200 ... -variables.

It means you can use pretty much any field in the object you're dealing with, or it's related parents and children.