Page 1 of 1

Field names for Email Templates

PostPosted: Fri Jul 03, 2026 4:06 pm
by pricerc
https://jiwa.atlassian.net/wiki/spaces/J8UG/pages/1399947266/Email+Templates refers.

I have some old templates that need converting to the new templates.

I see that the new 'tokens' are basically C# snippets.

Are there any guides/cheat sheets for getting started and identifying what's in scope (Other than the Object Browser and ILSpy) ?

'No' is an acceptable answer, I just don't want to spend a whole lot of time re-inventing the wheel.

Re: Field names for Email Templates

PostPosted: Mon Jul 06, 2026 10:41 am
by Mike.Sheen
Each field in the template is a C# script expression, and we use Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript.EvaluateAsync() to execute that, and we pass a Jiwa business logic object as the globals parameter, which is defined as "An object instance whose members can be accessed by the script as global variables."

In the case of a sales order email template, the globals is the Sales Order business logic (an instance of the JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder class) - so you have access to all the properties of the sales order business logic for sales order email templates.

Re: Field names for Email Templates

PostPosted: Fri Jul 10, 2026 12:42 am
by pricerc
I want to attach an XML-based EDI version of an invoice to an email that otherwise looks like a normal invoice email from a template. I have two scenarios in mind, one where there is just the XML, and another where there is both the PDF and the XML.

I think I can intercept the "formatted" email message before it goes out by trapping EmailingSalesOrderBefore and EmailingSalesOrder.

Does it matter which one I use to add the XML document?

Re: Field names for Email Templates

PostPosted: Mon Jul 13, 2026 6:49 pm
by Mike.Sheen
pricerc wrote:I want to attach an XML-based EDI version of an invoice to an email that otherwise looks like a normal invoice email from a template. I have two scenarios in mind, one where there is just the XML, and another where there is both the PDF and the XML.

I think I can intercept the "formatted" email message before it goes out by trapping EmailingSalesOrderBefore and EmailingSalesOrder.

Does it matter which one I use to add the XML document?


It shouldn't matter - what happens between the EmailingSalesOrderBefore and EmailingSalesOrder events is simply the generating of the report and attaching that, and setting a few more properties of the message (SourceType, SourceID, SourceDisplayNo and SourceForm).