Page 1 of 1

'headless' quote email.

PostPosted: Mon Oct 18, 2021 11:45 am
by pricerc
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 ?

Re: 'headless' quote email.  Topic is solved

PostPosted: Mon Oct 18, 2021 2:42 pm
by Scott.Pearce
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.

Re: 'headless' quote email.

PostPosted: Mon Oct 18, 2021 5:46 pm
by pricerc
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.