Field names for Email Templates

Discussions relating to Jiwa 8 plugin development, and the Jiwa 8 API.

Field names for Email Templates

Postby pricerc » Fri Jul 03, 2026 4:06 pm

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.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 520
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21

Re: Field names for Email Templates

Postby Mike.Sheen » Mon Jul 06, 2026 10:41 am

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.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2619
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 823

Re: Field names for Email Templates

Postby pricerc » Fri Jul 10, 2026 12:42 am

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?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 520
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21

Re: Field names for Email Templates

Postby Mike.Sheen » Mon Jul 13, 2026 6:49 pm

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).
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2619
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 823


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 0 guests