Custom Emails

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

Custom Emails

Postby Ernst » Tue Aug 25, 2026 2:11 pm

In JIWA7 we had plugins for adjusting the email subject message etc e.g. "Sales Order Custom Email,Purchase Order Custom Email" DO we have any similar ones in JIWA8?
User avatar
Ernst
Kohai
Kohai
 
Posts: 252
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 14

Re: Custom Emails

Postby Mike.Sheen » Tue Aug 25, 2026 2:13 pm

Ernst wrote:In JIWA7 we had plugins for adjusting the email subject message etc e.g. "Sales Order Custom Email,Purchase Order Custom Email" DO we have any similar ones in JIWA8?


No, a plugin could do that, but we thought with the Email Templates you wouldn't need a plugin to do that - the template you select does that instead.
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: 2628
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 824

Re: Custom Emails

Postby Ernst » Tue Aug 25, 2026 2:45 pm

OK I see I guess that works well, So once you select a template then it remembers it for next time.
We had quite a few scheduled emails also. e.g. to send Invoices each night, or to send out reports. See attached example.
Would this still work in JIWA8, Having trouble with Plugin.Manager.ResetReportSelectionFormulaTokens, and Plugin.Manager.AddReportSelectionFormulaToken


Plugin Accent Email - Sales with COGS report.xml
(85.1 KiB) Downloaded 2 times
User avatar
Ernst
Kohai
Kohai
 
Posts: 252
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 14

Re: Custom Emails

Postby Mike.Sheen » Tue Aug 25, 2026 4:50 pm

EmailReportDirect now wants a couple of dictionary parameters - ReportFormulas and ReportReplacementTokens - here is the signature:

Code: Select all
public void EmailReportDirect(JiwaFinancials.Jiwa.JiwaApplication.Report.Configuration.Report Report, string From, string EmailTo, string Subject, string CC, string BCC, string Message, string NameToGiveAttachment, ref string EM_Main_RecID, System.Collections.Generic.Dictionary<string, string> ReportFormulas = null, System.Collections.Generic.Dictionary<string, string> ReportReplacementTokens = null, bool RequestReadReceipt = false, string SourceID = "", string SourceType = "", string SourceDisplayNo = "", JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.clsSearch.SearchModes SourceDrillDownIndex = JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.clsSearch.SearchModes.jswUnknown, JiwaFinancials.Jiwa.JiwaApplication.JiwaReportProvider.ExportFormats ExportFormatType = JiwaFinancials.Jiwa.JiwaApplication.JiwaReportProvider.ExportFormats.PortableDocFormat, string SY_Forms_ClassName = "")


So instead of:

Code: Select all
Plugin.Manager.AddReportSelectionFormulaToken("{@PASS_FromAcc}", emailCandidate.DebtorStart)


You will want to create a dictionary for either or both ReportFormulas and ReportReplacementTokens, set the values and pass to the EmailReportDirect method.

ReportFormulas is for replacing the Crystal Report entirely with the provided value, ReportReplacementTokens will inspect formulas and replace parts of the formula matching the token key with the corresponding value.

From the look of your plugin, you're wanting to just set Crystal Formula contents, not a token replacement, so to just create a formula dictionary and add some values and pass that to EmailReportDirect, you would do:
Code: Select all
Dim formulas As New Dictionary(Of String, String)
formulas["{@PASS_FromAcc}"] = emailCandidate.DebtorStart ' Just setting a dictionary value will add it, or replace it if already present - no need to formally use Add
formulas["{@PASS_ToAcc}"] = emailCandidate.DebtorEnd
// And so on
Plugin.Manager.EmailReportDirect(reportToEmail, "admin@accent-tools.co.nz", emailCandidate.EmailAddress, message, emailCandidate.CCEmailAddress, "", message, FileName, EM_Main_RecID, formulas, null, "", False, sourceID, sourceType, sourceDisplayNo, sourceDrillDownIndex, exportFormatType);
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: 2628
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 824


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 1 guest