function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
guhtguht 

Automatically generate custom PDF quote and send email based on custom input fields?

I would like to give the users several dropdown input field to build a custom quote, attach those custom fields to values in a template, automatically generate a PDF and then send that PDF to client.

 

I have seen examples of generating a PDF for a quote, but not examples of using custom input fields to build the quote?

 

Do examples for this exist?

 

What aspects of visualforce, apex, etc should I specifically look at to accomplish this?

 

Should the values for these dropdown boxes be stored inline inside the page? Or can/should I create a custom table to store these values so they can be easily accessed and changed/updated when needed?

 

I apologize for the broad general question, but appreciate any help!

 

Kind Regards,

Jim

Janet GuoJanet Guo

You can put a custom button on the custom quote that sends an email with the generated PDF attached. For testing purposes, you might want to also have a button that only generates the PDF, so you don't have to check your inbox for the PDF every time when you're creating the PDF.

 

You can directly generate PDFs using Visualforce and you would just get the value from the custom quote record the same way you would do it for a regular Visualforce page.

 

Something like:

<apex:outputText value="{![Object reference].[Field's API name]}" />

 so if I wanted to get a Quote's Account Name, it'd look something like this on the Visualforce page:

<apex:outputText value="{!quote.Account__r.Name}" />

 where "quote" is the public variable name declared on the Apex controller side that refers to the custom quote and there's a field on the Quote object that looks up to the Account.

 

Also, make sure to include the field name when you query to get the custom quote on the Apex controller.

 

Hope that helps!