PDF Generator

GoCloudz CPQ - PDF Generator for Salesforce

Getting Started #

PDF Generator allows user to generate highly customized and branded PDFs for any Standard or Custom objects. Everything happens within SFDC which makes is super easy and convenient for the end users. In order to generate the PDFs, first build the template(s) based on your design requirements and then make those available to end users. Let’s get started…

1. Install PDF Generator using “Get It Now” button on AppExchange, if not done already – https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3000000B4AsxEAF

2. During installation please ensure to select “Install for All Users”. This is important to provide needed security permissions to all Profiles. (Note: users will not be able to see/use any of the application features until a license is assigned to him/her. Click here to see how to manage licenses for the app).                                                                                                                                                   

3. Once application is installed, go to “PDF Template” tab.  If you don’t see that tab, click on “+” sign on top, click on “Customize My Tabs” and add this tab to the list so that it’s easily accessible.       

4. As part of installation we have provided sample templates for Quote, Opportunity, and Order objects. Click the “Go” under “PDF Template” menu to check those templates.

5. You can either modify one of these templates or Clone them (recommended).

6. Next step is to design templates.

This documentation is very detailed with step by step instructions on how to customize almost every aspect of the PDF. You can skip the sections that are not applicable to your use case.

Need help? We provide end-to-end template design services. Our experience will help you save time. Engage our services team for template design and e-signature configuration. Please check pricing section for more details. For further queries, please contact us at sales@gocloudz.com

PDF Template Basics #

This section describes basic elements of PDF Template configuration. Here are the field definitions –

Template Name – Name of the template which end user will see while generating PDF

Active –  Template will be available for end user to use only when it’s active

Object – API name of the Object for which the template is designed for. Some of most common objects like Lead, Account, Quote, Opportunity etc are included by default. To add additional standard or custom objects go to Setup >> Object Manager >> PDF Template >> Object field

Some of the frequently used Standard Object API names are Account, Lead, Order, Product & Case.

To find Custom object API Name –

  • Go to Setup >> Object Manager
  • Click the Object name >> Details >> Check for “API name” column

Style – Fields in this section define the overall PDF style

Header and Footer – Header and Footer are similar to MS Word header and footer which are repeated in each page.

Title – Title content is shown above PDF Tables. This section usually contains information like whom the document is prepared for, company information, etc

PDF Table – PDF Table is shown as tabular section with in the PDF . This section is used to show information from related lists. For example, for Quote object, Quote Line Items data can be displayed and for Opportunity object, Opportunity Products data can be displayed as table in the PDF.

Aggregate Fields – These are shown after all the PDF Table(s) and are generally used to display aggregate values. For example, for Quote object it can show TotalPrice, Tax, Grand Total, VAT, Shipping & Handling charges etc. or any custom field on Quote object.

 

Notes:

  1. Wherever Color field is specified, use Hexadecimal color code. This is one of the sites to get the code – https://www.w3schools.com/colors/colors_picker.asp
  2. If you are designing the template for objects other than Quote or Opportunity, please refer ‘Other Objects‘ section for additional configurations required.

 

Preview Template


Preview – As a template designer you can preview the template with live data to verify the design and merge fields before activating it for the end users. After clicking the Preview button, click on the search box to see recently used records or search for any existing record in your database.

 

Clone Template


Click iClone button to create an exact copy of the entire template with all the configurations in single click. When a template is cloned, it appends “***” to the name of the cloned template to differentiate between original and cloned version. Click the arrow if you do not see iClone button.

Note:

iClone is our another AppExchange app and “Clone Template” functionality is provided as part of PDF Generator to quickly make copies of the templates. iClone app allows user to quickly clone records along with any related lists and supports field over-rides. It works for any Standard and Custom objects. Please contact support@gocloudz.com for queries related to this app.

PDF Table #

This section describes PDF Tables. PDF Tables are used to display related list fields and data, e.g., in case of Quote it can show Quote Line Items details, for Opportunity it can show Opportunity Products details.

One PDF Table corresponds to one table in PDF. PDF Table consists of PDF Columns which correspond to Table columns in PDF.

Let’s check configuration options in more details.

PDF Table Detail


Table Title: This is displayed on top of the table & is used to differentiate between tables like products, services etc.

Order: If you have multiple tables you can order them using this field.

Formula: This is used to group related list items in the PDF table by any custom or standard field. If no grouping required, keep this field blank and in that case all related list items will be displayed in the corresponding table. Primary use of this feature is to provide more clarity on cost breakups in a quote/invoice/contract/PO

Here are some examples of Formula:

For Quote Line Item having lookup relationship to standard Product object:

Product2.Family=’Services’  – groups all line items having Product family = ‘Services’

For Quote Line Item having lookup relationship to standard Product object & having a custom field :

(sfcloud__Product_Bundle__c=” AND  Product2.Family LIKE ‘%Subscription%’)   – groups all line items where sfcloud__Product_Bundle__c custom field is blank and Product family contains Subscription

 

 

Object Name: Related Object API name from which data is pulled from. E.g., QuoteLineItem, OpportunityLineItem, OrderItem for Standard Quote, Opportunity and Order Objects. It can be any other Custom object which is related to object selected in Object field on Template.

Field Name: Related Object Field API name which has relationship with parent object. E.g. QuoteId, OpportunityId, OrderId for Standard Quote, Opportunity and Order Objects. In case of Custom object, it will be a custom relationship field API name.

Display on New Page: When selected, this Table will be shown in next/new page always.

Show aggregate fields outside the table: When selected it will show Aggregate (like Sum, Average etc.) for PDF Columns after the table as separate line. In this case Aggregate Label, Field Type and Aggregate Type should be mentioned in PDF Column as described below.

Hide Table Title: When selected, it will hide the Title from the table.

Bundle View? and Group Bundles: These are useful when you are using our other Appexchange App CPQ/Product Bundle and want to group items based on the Bundles. Please check next section for more details on configuration options with Bundles. No need to select anything if CPQ/Product Bundle application is not being used.

Additional Info: Content of this field are displayed after the table. It’s a Rich Text Field and all formatting concepts explained in previous section for Rich Text Field are applicable. Please note that content of this field will not be shown if corresponding PDF Table is not shown in PDF.

Title Align, Background Color, Font Size and Font Color: These fields control the styling of Title/Header of the table

PDF Columns


PDF Columns are equivalent to columns/fields of related list.

 

Following are the PDF Column field details –

Label : This is shown as column header on the table in PDF.

API Name : API Name of the related list field Data needs to be pulled in from as a column in the table. E.g., Quote Line Item Standard fields can be specified as Description, Quantity, SubTotal, Discount, TotalPrice etc. Custom fields API names can also be specified in similar way.

For objects having relationship with this object, cross object formula syntax should be used as per standard SFDC guideline. For example, Product is having a lookup relationship with Quote Line Item so Product Family API name should be used as PricebookEntry.Product2.Family.

To display multiple field values in single cell, build the necessary formula field on the respective object and provide the “API Name” for the formula field. E.g., if PDF is built for Quote, to display product name and description from Quote Line Item in single cell build a custom formula field on Quote Line Item with this formula pricebookentry.Product2.Name & pricebookentry.Product2.Description or pricebookentry.Product2.Name & br() & pricebookentry.Product2.Description and use the API name of that Formula field.

Order: Defines the relative order of the columns in the table

Width: Column width in %. Please do not append %. As much as possible total of all columns width should be 100%.

Group By: When it’s checked, table rows inside the table are grouped based on this column. For example, if API Name for a column is specified as PricebookEntry.Product2.ProductCode & if Group By checkbox is checked for this column, all rows will be grouped by ProductCode. This provides one more level of grouping inside the table.

Aggregate Label: Label for the Aggregate value at the end of the table.

Aggregate Type: Defines the aggregation like Sum, Min, Max, Avg or Append for that column.

Field Type: Display format for the aggregated value. For example, if Currency is selected, it will show currency code in front of the value.

If Show aggregate fields outside the table checkbox is not selected in PDF Table configuration as explained above, aggregates will be shown as last row in the Table.

 

Header Style: Fields in this section define column header text alignment, background color, text color and weight.

Column Style: Fields in this section define column text alignment, background color, text color and weight.

Aggregate Style: Fields in this section define aggregate value text alignment, background color, text color and weight which is shown at the end of the table.

 

Notes:

  1. If PDF Table is defined please ensure that at least 1 PDF Column is defined else PDF will throw error.
  2. If related list details are not needed in PDF as table, no need to configure PDF Table.
  3. If any column has zero or blank value for all rows, that column will be hidden in the PDF.
  4. If there are no items in related list or if none of the related list records are matching formula criteria, that table will be hidden in the PDF.
  5. If any Line item is not supposed to be shown in the table in PDF, check “Do Not Show on PDF” Checkbox on Line Item level.In this case aggregation will happen only for the rows shown in the PDF.

Aggregate Fields #

Aggregate fields are shown after all PDF Tables and before T&C content. These are primarily used to show Grand Total, Total Discount, Tax, Shipping and handling, VAT etc.

Please note that these field are different than Aggregate Fields in PDF Table. Aggregate Fields in PDF Table are pertaining to the aggregate value of a particular column within that table, while these fields are used to show aggregate value of entire PDF. Also, Aggregate Fields in PDF Table pull details from related list e.g., QuoteLineItem, while these Aggregate fields pull details from parent object which is selected in the Object field, e.g., Quote or Opportunity.

Field configurations are same as explained in PDF Table.

 

PDF with Product Bundle #

Notes:

  • This section should only be referred if you are using – Product Bundle app and need to display Bundle information on PDF
  • This is only applicable for Quote, Opportunity, Order, and Work Order objects, those are the objects supported by Product Bundle app
  • PDF Table tutorial should be reviewed before this tutorial

Bundle views are similar to Aggregate Fields explained in PDF Table tutorial with a difference that bundle view shows only aggregate information and hiding bundle item details.

Following are the steps to show Bundle views in PDFs –

PDF Table configuration:

  1. Use Formula field to show only line items that are part of a Bundle. For example – sfcloud__Product_Bundle__c!=”, where sfcloud__Product_Bundle__c is a custom field on Quote Line Item and is part of the Product Bundle app
  2. Under Display Options, select Bundle View checkbox
  3. Select Group Bundles picklist field
    1. Tabular shows Bundle details as row of the table
    2. Compare shows Bundle details as column of the table.
    3. Keep it blank to show each bundle as individual table on the PDF. Bundle name becomes the table header

PDF Column configuration:

  • API Name: This is same as explained in PDF Table tutorial with an exception that relationship fields like pricebookentry.Product2.Family are not supported in this case & in order to use the API Names of related objects, create custom Formula fields and use API Name of that formula field.
  • Aggregate Label: This needs to be filled to show content in the table column. If this is not specified, column will be blank.
  • Field Type: This specifies data type of column, e.g., for Description type of column it should be set as String, for Quantity or Price type of columns it should be set as Number/Currency.
  • Aggregate Type: This defines type of aggregation e.g., ‘as-is’ is used to show 1st line item field value without aggregation like Bundle Name, ‘Avg/Min/Max’ is used to aggregate numeric values like Quantity/TotalPrice/UnitPrice, ‘Append’ is used to concatenate string fields like Description etc.

Following are few examples of different Bundle views for the PDF Column configuration shown above –

Two Bundles added to Quote Line Item

If Group Bundles = Tabular in PDF Table configuration

If Group Bundles = Compare in PDF Table configuration

If Group Bundles = –None– in PDF Table configuration

Preview, Save, and Email PDF #

Once the templates are verified and activated, users can start using those to generate PDF the email them to Recipients. There are couple of way to go about this –

Manual: Users can go to the record , click ‘Create PDF and Email” button, select PDF template, select Email template, and then finally email them. This does not sound a lot but if users are sending many emails on daily basis, then it adds up.

Automatic: Other option is to take advantage of PDF Rules to automate all the steps mentioned above. The rules will trigger based on record changes. For example, email PDF to Recipients when Opportunity is Close-Won or Quote is Approved.

Please see next section explaining each one in detail.

Note:

  • If you are using automation, we highly recommend to test the flow thoroughly for internal users. Once everything is working as per the business rules, you can make them available for your recipients.
  • Recipients attached to a record are applicable to both, Manual and Automate process. Please see Recipients section on how to automate Recipients or add one manually.

Manual (End Users) #

This section walks through the configuration required to enable end users to create and email PDFs manually.

As part of the app we have provided a custom button “Create PDF and Email” for Quote, Opportunity, and Order objects by default (To create button for other objects, please see this section).

Modify the object page layout where PDF is to be generated to add the buttons. If you are using Lightning view, please add the buttons to Mobile and Lightning Actions as well.

Here are the steps end user (Sales Rep) will follow to preview and email PDF.

1. User clicks on Create PDF and Email button.

 

2. User is redirected to PDF Preview page which shows the record name on top-left and list of available templates in the drop-down list. Select a template to preview the PDF. User can then either save the PDF back to record or email it using “Save and Email” button.

Note: If only 1 template is available, it will be selected by default.

 

3. User will be redirected to Email screen if they selected “Save and Email” option. They can provide additional information like CC, BCC, Subject, Body, etc. PDF will be attached automatically to the email. Please see Recipients section on how to automatically add users as To, CC, or BCC.

Please note, Recipients need to be setup for objects other than Quote, Opportunity or Order object else “Save and Email” button will not work and please check this section for more details.

Note: You cannot select an email template in Lightning experience. Please switch to Classic if you need to select an email template. Or you can automate the email process using PDF Rules which works in both, Classic and Lightning.

 

4. PDFs are stored under “Files” and “Notes & Attachments” section of the record. For Quote object, the PDF is also stored under standard “Quote PDFs” section.

 

5. All email activity like when the email was sent, who sent it, whom it was sent to, attachments, etc is stored under standard Activity section.

Automatic (PDF Rules) #

This section walks through the configuration required to automate PDF process described in the the Manual section.

Save time for your sales rep and define “PDF Rules” to auto generate PDF and Email based on your business logic without the need of clicking Create PDF and Email button . For example, if an opportunity is Close Won, generate and email the PDF to recipients using pre-defined templates. (Note: It’s highly recommended to test Email feature with internal users before enabling it for customers)

Define Remote site setting by going to Setup >> Security >> Remote Site Settings. The Remote Site URL is your org URL. If you have enabled communities, add site URL as “https://MyCompany.my.salesforce.com” where “MyCompany” is name of your community

Click on PDF Rules tab and click New button to define new rule or select an existing rule to view/modify it.

Sample PDF Rule

Field Definition

Name: Enter a name which is easy to recognize

Object: Object name is populated automatically based on the PDF Template selected

Field Name and Field Value: These fields define evaluation criteria for rule to fire. In Field Name specify the field API Name which needs to be checked for the value defined in Field Value. In above screenshot, the PDF will be generated when Opportunity StageName changes to Proposal/Price Quote

PDF Template: The template that will be used to generate the PDF if the Field Name and Field Value match

Order: If there are multiple rules defined for an Object, Order field determines which one will be executed first

Email Template:  The template that will be used to email the PDF to recipients. Go to Setup >> Email Template to get the Salesforce Email Template ID (see the screen shot below). Copy the Id from the template URL as shown below. Note: Once an email template is provided, an email will be sent using this template. So it is very important to test the automation internally using “Internal Email Id” first.

Internal Email Id(s): Specify internal email IDs (separated by semi-colon) to test the PDF email automation before enabling it for end customers. If populated, emails will be sent to email ids specified and not to the Recipients. Once you have tested the automation internally, make this field blank to start sending emails to Recipients

CC me and BCC me: If checked, the PDF will be emailed as CC or BCC to the user who modified the record

 

To evaluate a rule based on multiple fields, create a custom Formula field with the business rule and then specify the API Name of that formula field as the Field Name above. For example, if rule needs to be executed based Opportunity StageName and Payment Mode, following formula can be used in the formula field  –

IF(
 ISPICKVAL(StageName, 'Proposal'),
 IF(
  ISPICKVAL(Payment_Mode__c, 'Bank Wire'),
  'Bank Invoice',
  IF(
   ISPICKVAL(Payment_Mode__c, 'Paypal'),
   'Paypal Invoice',
   ''
  )
 ),
 ''
)

Assuming the API name of the formula field is “Send_Invoice__c”, the rules will be configured as below

Notes:

  • For objects other than QuoteOpportunity or Order object an Apex Trigger needs to be created for PDF Rules to work properly and please check this section for more details.
  • For a rule to fire, the PDF Template attached must be Active
  • PDFs are generated using asynchronous process so it may take few seconds for the PDF to appear. Please refresh the page if you do not see the PDF attached automatically. If you still do not see the PDF, please ask your system admin to verify “Remote Site” and “PDF Rules” for the object
  • And for one last time, it’s highly recommended to test Email feature with internal users before enabling it for customers

E-Signature #

PDF Generator supports Docusign for e-signatures. Please contact support@gocloudz.com if you like to integrate with other e-signature vendors like Adobe Sign and eSignLive.

Following are the key benefits of using e-signature along with PDF Generator

  1. Send PDFs for e-signature without leaving Salesforce
  2. Automate Recipients who will receive the document for e-signature
  3. Define order in which recipients will sign the document
  4. Track all e-signatures status in real time right within Salesforce. Quick glace gives complete picture of the envelop, like what is the overall status, when did each user sign the document, decline reason, etc.
  5. Signed PDFs are stored with in Salesforce for history tracking

 

Notes:

  • Docusign subscription needs to be purchased separately and it’s not included in PDF Generator cost
  • E-Signature integration is handled my our Managed Services team. Please contact support@gocloudz.com for cost or integration related queries
  • For Docusign, Business Pro or above version is required which supports Salesforce integration
  • Support related to e-signature tool, usage, training, or defects should be raised with respective e-signature vendor
  • Following DocuSign tags are supported –
    o Sign
    o Full Name
    o Initials
    o Title
    o Date Signed

 

End User Experience


Once e-signature is configured by our team, following step needs to be followed by end user to send PDF for e-signature and track the status within SFDC –

1. Enter details for each recipient
Signer Role: Identifies where the user needs to sign on the PDF. The e-signature tags are stored on the PDF template
Order: Order in which the document should be received for e-signature. Provide same order number, if all the recipients can sign the documents at same time

2. Click on Create PDF and E-Signature button on the record. Click the down arrow if you do not see the button

3. User is redirected to the page to select a template and preview the PDF

4. After review, click Save and Send for E-Signature

5. PDF will be sent to the recipients and user will be redirected back to the record

6. PDF is saved under Quote PDFs (for Quote) and Note & Attachments related list, Recipients will receive an email like below from Docusign

 

7. Track status in real time in E-Signature Status related list

 

Docusign Email Subject and Blurb


Go to Setup >> Custom Settings >> PDF Settings custom setting to personalize e-signature email subject and blurb. Click “Edit” to edit the default values.

 

E-signature Recipients and Order


Go to Setup >> Custom Settings >> Default Recipients custom setting to define default recipients for each object and the order in which they will receive the document. Select “E-Signature flow sequential?” checkbox to send the document only if previous recipient has signed it. For example, the document must be signed by VP of Sales before it is sent to customer for e-signature.

 

Docusign Account Details


Go to Setup >> Custom Settings >> PDF E-Signature custom setting to enter your Docusign account details. Provide org wide setting which serves as default docusign account to be used for sending emails. If user has docusign account, enter user specific details by clicking “New” button.

Note:

  • Account Id and Web Service URL remains same for all users
  • For User Id, we recommend using your Docusign id and not email
  • You can get Docusign Account Id and User Id by logging into your Docusign portal

 

Additional Documents


Sometime you may want to attach additional documents along with the PDF for your recipients to review or sign. For example, additional T&C, product specific information, etc. You can do that easily by uploading the document to the “Note and Attachments” section of the record. The file name must start with e-sign_. For example “e-sign_Product_Info.txt” in below example.

Recipients #

Recipients object stores User, Contact, or Lead to whom the PDF will be emailed or sent for e-signature. While emailing you can also specific how the recipient would get the email – To, CC, or BCC. You can either add recipients manually or automate it.

NOTE – Recipient object is pre-configured for Quote, Opportunity, and Order objects. To configure for other objects, please see this section.

Please edit the page layout if you do not see the Recipients related list on the Object. Click “New” to add a recipient manually.

Field Definition –

Quote, Opportunity, and Order: Objects to which this recipient is related to. Please see this section to configure recipients for other objects

Lead, Contact, and User: These are lookup fields to respective objects. Please select any one of them as recipient

Name: Formula field to show name of the recipient selected above

Email: Formula field to show email of the recipient selected above

Primary: Select this check box to mark the recipient as primary. Primary recipients information will be merged when sending emails

Receive email as: Specify whether this recipient will be in To, CC, or BCC

Signer Role : This field is applicable only when you are using e-signature and defines the area where different signers will sign the document. Corresponding to each signer role, e-signature tags are placed on the PDF template.

Order : This field is applicable only when you are using e-signature and defines the sequence in which the document will be sent to the recipient.

Check E-Signature section for more information on default recipients, email blurb and Docusign account details.

 

Recipients Automation


Recipients can be added manually as shown above but this means less time for the reps for things that matter. Let’s see how they can be added automatically when a record is created which will not only save time but will be more robust.

Go to Setup >> Custom Settings >> Default Recipients custom setting to define default recipients for each object and the order in which they will receive the document. “E-Signature flow sequential?” is applicable if you are using e-signature. Select this checkbox to send the document only if previous recipient has signed it. For example, the document must be signed by VP of Sales before it is sent to customer for e-signature.

You can add field API name of any related Lead, Contact, or User as here. For example, if there is a custom lookup field on Opportunity referencing Contact object with the API name Contact__c, then specify Contact__c in the custom setting for Opportunity. Here are the steps to update these custom settings –

1. Go to Setup >> Custom Settings >> Default Recipients >> Manage

 

2. Click “New’ to configure recipients for new object or click “Edit” to update existing object. Note, there must be only one row for each unique object

Note:  For e-signature Recipient is mandatory

Restrict Template #

By default all active templates are available to end users for generating PDF. This may not be good option if you would like to restrict list of available templates based on the record stage, status or any other value. For example, if Opportunity is in Proposal stage, then only Proposal template should be available to end users. Similarly, if the Opportunity progress to Invoice, then only Invoice template should be available to end users.

Using PDF Rules, you can now map what templates are available based on field name-value pair. These is the same PDF Rules object we have configured previously, so all you have to do is enable below custom settings to restrict what templates users can use based on those rules defined.

Go to Setup >> Custom Settings >> PDF Settings >> Manage >> Edit “Default Configuration” >> Select “Filter Templates” flag.

Watermark #

There are many ways of protecting confidential information, one of them is watermark. There are many reasons to watermark PDF too:
– sending legal or government documents
– creating PDF documents that can be immediately recognized
– safeguarding intellectual property

Applying watermark to the generated PDF documents is very easy.

1. Store the watermark file in your static resource within Salesforce

2. Click “View file” to get the URL

3. Paste it in “Watermark” field

4. Once watermark is populated, it will be applied each time new PDF is generated

 

Watermark field exists for Opportunity, Quote, and Order objects. For other objects, create URL field like below and add to the page layout.

 

Dynamic PDF Name #

By default the name of PDF and the Files generated will be the name of the record. For example, for Opportunity PDF it will be Opportunity Name, for Lead PDF it will be Lead Name, etc.

You can override the default name of the files generated by creating custom field on the object. It can be of any field type as long the API name of the field is “GoCloudz_PDF_name”. It can be a formula field too.

For example, if you create below formula field on Opportunity object, then the new files generated will have Account Name followed by Opportunity Amount as the file name.

 

 

Additional Attachment #

tbd.

Dynamic Content #

It is very common for Reps to send additional data when sending the PDF to their clients. Information can be product specific, regional t&c, or related to type of customer. As the information is not directly available in Salesforce, they may be tempted to copy-paste into email or use merge field notation which not only increases time to send the proposal to their clients, but also increases chance of sending wrong info. Manual copy paste can be avoided and automated with the help of PDF Attachments feature.

It’s similar to merge fields but with a difference that these content will be stored outside of the record under PDF Attachment tab which can then be referenced on any record. This gives flexibility to add dynamic content based on your business rules.

It’s 3 step process and following are the details –

1. Go to PDF Attachments tab and click “New” to define attachment details –

Attachment Name : Provide user friendly name

Description : Provide description that explains the content. It is optional

Content: There are 2 Rich Text fields provided to allow large content. It supports all the features mentioned in Rich Text Fields section, including merge fields and custom HTML

 

2. Use the attachment tags on PDF template –

Add attachment tags where you would like to show the data. For example, Title, T&C etc.

{!GoCloudz_Attachment_1__c} and {!GoCloudz_Attachment_2__c}

 

3. Lastly, populate Attachment 1 or Attachment 2 lookup fields on the record the PDF is generated for. If you do not see attachment fields, please ask your System Admin to edit the page layout

ProcessBuilder can be utilized to dynamically populate Attachment 1 and Attachment 2 lookup fields depending on your business requirement. For example, add “EMEA GenWatt Diesel” attachment if Quote is for EMEA and has GenWatt Diesel line item.

 

Objects other than Quote, Opportunity, or Order #

If you designing PDF templates for objects other than Quote, Opportunity, or Order, there are few additional configurations required. Please see them below.

Note: We have considered a custom object with API name as My_Object__c as an example for this tutorial. In your case it can be standard objects like Account, Lead, Case or any custom object

Custom Buttons


Create custom URL button named on the object you are planning to generate PDF –

Name: Create PDF and Email

URL: /apex/sfcloud2__QuotePDF_Save?id={!My_Object__c.Id}&action=sendEmail

Example:

Once created, add this button to appropriate page layouts. For Lightning experience, add the button to Mobile and Lightning Actions too.

If you are using e-signature, create similar button like above but with below properties

Name: Create PDF and E-Signature

URL: /apex/sfcloud2__QuotePDF_Save?id={!My_Object__c.Id}&action=sendForESignature

 

Recipient Lookup Field


Create new lookup field on Recipients object if you want to automate Recipients. In the “Related To” field select the object the PDF is being created for. API name of the lookup field must match API name of the object. For example, if the API name of the object is My_Object__c, the field name of the lookup field must be My_Object.

Example –

 

Add Recipients related list by editing My_Object page layout.

 

Custom Settings


Create a new custom settings under Default Recipients only if you want to automate Recipients.

Please follow these steps to add a new custom setting –

1. Go to Setup >> Custom Settings >> Default Recipients >> Manage

 

2. Click New

 

3. The name must match the API name of the object. For example, My_Object__c. Specify the User, Contact, or Lead fields which needs to be added as default recipients upon creation of the record. For example, for My_Object__c, if there is a custom Contact lookup field with API name Contact__c. Specify Contact__c as the field API name. To specify multiple recipient, simply enter them on new line.  Also, If you want to add user, contact, or lead field from related object you can use ObjectName.FieldName syntax, for example Opportunity.OwnerId

As per below configuration, each time new My_Object__c record is created, it will automatically add user who created the record and the contact as recipients.

4. Click Save

 

Trigger


Create trigger only if you are using PDF Rules or want to automate Recipients.

Create trigger by replacing My_Object__c in the code below with the API name of the object

Note : It may throw error for single quotes so please copy the code in notepad and re-type single quotes before pasting it

trigger CreatePDF on My_Object__c (after insert) {

 //Continue only if user has PDF Generator license assigned
 if(UserInfo.isCurrentUserLicensed('sfcloud2')){

  //Check for recursive trigger
  if(!sfcloud2.QuotePDF_Utility.isTriggerRunning){

   //Set trigger variable
   sfcloud2.QuotePDF_Utility.isTriggerRunning = true;

   //Create default recipients
   sfcloud2.QuotePDF_Utility.copyRecipient('My_Object__c', trigger.new);

   //Reset trigger variable
   sfcloud2.QuotePDF_Utility.isTriggerRunning = false;

  }
 }
}

 

 

Suggest Edit