'headless' quote email.  Topic is solved

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

'headless' quote email.

Postby pricerc » Mon Oct 18, 2021 11:45 am

I want to send out automated quotes (generated by the scheduler on the server) with a PDF attachment.

For SalesOrders, we have a "GetCandidateReportsToEmail" that we can use to pick a report from in code, but we don't seem to have a similar option for Quotes.

So what's the best way to find the ReportDefinitions available for SalesQuotes, so that I can use one in a SalesQuote.Email() in a scheduler ?
/Ryan

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

Re: 'headless' quote email.  Topic is solved

Postby Scott.Pearce » Mon Oct 18, 2021 2:42 pm

Create and read in a ReportDefinitionCollection of your own:

Code: Select all
reportDefinitionCollection = Manager.BusinessLogicFactory.CreateBusinessLogic<JiwaApplication.PrintGroup.FormReports.ReportDefinitionCollection>(null);
reportDefinitionCollection.PrintGroup = Manager.Staff.PrintGroup;
reportDefinitionCollection.Form = Manager.Forms["JiwaFinancials.Jiwa.JiwaSalesUI.SalesQuote.SalesQuoteEntryForm"];

reportDefinitionCollection.Read();


The Email() method wants, among other parameters, a JiwaApplication.Report.Configuration.Report passed to it. Get this via the .Report property of your chosen collection item:

Code: Select all
reportDefinitionCollection.DefaultReportDefinition.Report


or

Code: Select all
reportDefinitionCollection[0].Report


etc.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: 'headless' quote email.

Postby pricerc » Mon Oct 18, 2021 5:46 pm

Scott.Pearce wrote:Create and read in a ReportDefinitionCollection of your own:

Code: Select all
reportDefinitionCollection = Manager.BusinessLogicFactory.CreateBusinessLogic<JiwaApplication.PrintGroup.FormReports.ReportDefinitionCollection>(null);
reportDefinitionCollection.PrintGroup = Manager.Staff.PrintGroup;
reportDefinitionCollection.Form = Manager.Forms["JiwaFinancials.Jiwa.JiwaSalesUI.SalesQuote.SalesQuoteEntryForm"];

reportDefinitionCollection.Read();



Thanks. That looks much better than my:
Code: Select all
client = salesQuote.Manager.FormFactory.CreateForm(Of SalesQuoteEntryForm)(Nothing)
client.ReportDefinitionCollection.Read()


which while it works, instantiates a whole unnecessary SalesQuoteEntryForm.
/Ryan

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


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests