This guide covers the GoCloudz PDF Generator app for Salesforce: building branded PDF templates, generating, emailing, and automating PDFs, and collecting e-signatures with DocuSign. Please select a Role below to show only topics applicable for the role.
PDF Generator allows user to generate highly customized and branded PDFs for any Standard or Custom objects. Everything happens within Salesforce which makes it 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. It is recommended to select “Install for All Users”. This will give needed security permissions to all the profiles. If you select any other option and later want to test as end users, you can assign “PDF Generator” permission set to the users to make sure they have the necessary access.

(Note: For Production installation, a license needs to be provisioned to the users who will be using the app. For Sandboxes, all users in the Org have access to the app features for unlimited time. See how to manage licenses for the app).

3. Click on App Launcher & search for PDF Generator App

4. Click on PDF Template tab. As part of installation we have provided sample pre-designed templates for Quote, Opportunity and Order objects.

You can either modify one of these templates, Clone them to create new one (by clicking on template name & selecting Clone Template option) or can create New from scratch.
This documentation provides 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 business case.
Overall Style – This is the first step to specify template name, select Object PDF to be generate for & template level styling options. Please check Overall Style section for more details.
Header – This defines the content which needs to be shown as PDF header which is similar to MS Word Header and is repeated in all pages of the PDF. Please check Header section for more details.
Title – This defines the content which needs to be shown starting 1st page below header.
Tables/Columns – Tables and columns are defined to show related list records in tabular format. One table corresponds to one related list and columns correspond to related object fields. 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.
Aggregates – These are shown after all the PDF Tables 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.
T&C – This defines the content which needs to be shown after Tables/Aggregate Values (if defined)
Footer – This defines the content which needs to be shown as PDF footer which is similar to MS Word Footer and is repeated in all pages of the PDF. Please check Footer section for more details.
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. To preview –
1. Click on the Preview button

2. Click on the search box to select recently used records or type to search other records

1. Click Clone Template button on top of the template to create an exact copy of the entire template with all the configurations copied.

2. You can specify the name of the new template & activate it as well.

This section defines Overall Style, Format, Header, Title, T&C and Footer sections in more detail.
Template Name – Name of the template which end user will see while generating PDF
Object – PDF templates are designed for specific object and any Standard or Custom object can be selected which is present in your org.
Active – Template will be available for end user to use only when it’s active. As template design/admin, you can check the design using preview option even if it’s inactive
PDF Name – The name of the document generated using this template and saved under Files and Notes & Attachment related lists. You can use merge fields to append dynamic information to PDF name as well, for example, you can specify the name as – Quote for {!Account.Name}, which will append Account Name dynamically. You can insert merge field using field picker.
If you want to have today’s Date or Time stamped in PDF name, you can manually type functions like {!Today}.Date or {!Today}.DateTime, for example, “Quote for {!Account.Name}-{!Today}.DateTime”.
If this field is left blank, name of the PDF will be same as record name by default.
Page Size – Select Page Size or orientation for the PDF
Page Number Format – Select the format of the page number that is displayed in the footer of the PDF
Date Format – Select the format for Date and DateTime type fields. The field values are formatted when {!fieldAPIName} is appended with “.Date” or “.DateTime” function.
For example – {!CreatedDate}.Date or {!CreatedDate}.DateTime. If the “Date Format” is blank or these functions are not appended, the PDF will print date as per the logged-in user locale.
Time Format – Select the format for Time and DateTime type fields. The field values are formatted when {!fieldAPIName} is appended with “.Time” or “.DateTime” function.
For example – {!CreatedDate}.Time or {!CreatedDate}.DateTime. If the “Time Format” is blank or these functions are not appended, the PDF will print time as per the logged-in user locale.
Background Color – Background color for entire PDF can be specified. By default white is selected but can be changed using color picker
Following are the common design and automation features for all of these sections – header, title, t&c, and footer
WYSIWYG editor : has been provided to format the content for example, text styling, alignment, color, font family, size, hyperlinks etc. We recommend using table feature for better alignment of the content similar to MS Word. You can show content in the table with or without border.
Use image icon to upload images from local drive or insert from a URL. To resize the image, right click the image and change Height and Width of the image.
Check video tutorial for more details on design concepts.
Choose Field : You can pull Salesforce data into PDF using merge fields. Data can be pulled from the object which is selected in Overall Style tab or from any related object (i.e. objects which are having lookup/master-detail relationship with that object).
For example, if Quote object is selected in Overall Style for the PDF, you can insert any Quote field or any field from the related objects to Quote like Opportunity, Account, CreatedBy, or any other related object.


Use Copy & Paste (Ctrl V) to paste in the editor.
Following are the merge field formats –
{!FieldAPIName} – for the fields on same object the template is designed for.
{!ObjectAPIName.FieldAPIName} – for the fields on the related object.
Note: Please note Address fields are composite fields and values are stored in separate fields in Salesforce database so for printing entire address we need to use following API names –
{!BillingStreet}, {!BillingCity}, {!BillingState}, {!BillingCountry} {!BillingPostalCode}
PageBreak: This button inserts merge field to insert Page Break in the format {!PageBreak}. Any content after this keyword will always start from new page
Today: This button inserts merge field for printing date of PDF generation in the format {!Today}.Date. It prints the date in the format selected in Overall Style tab.
Page#: Page number can be printed dynamically and page number format is shown in the format selected in Overall Style tab. X & Y values are replaced with dynamic numbers based on total number of pages. It inserts following keyword in merge fields format – {!PageNumber}
This is similar to MS Word Header and is repeated in all pages of the PDF.

Margin (Top) : It defines spacing from top of the page. Margin value should be reduced or increased based on the header content height.
Title content is shown after header starting with first page of the PDF.
Show Header and Footer on Title Page : This controls whether Header and Footer will be shown on the first page of the PDF
Title Fields : WYSIWYG editor has been provided to format content on first page of the generated PDF.
Note: We have provided 2 Title fields to allow large content

T&C content is shown after PDF Tables which is discussed in separate section of this tutorial.

If you are not using PDF Tables, you may not use T&C fields and all content can be designed in Title section (provided content size doesn’t exceed Title fields character limits).
Multiple fields have been provided to allow accommodating large content.
Please see E-Signature section if you like to include e-signature tags
This is similar to MS Word Footer and is repeated in all pages of the PDF.
Margin (Top) : It defines spacing from bottom of the page. Margin value should be reduced or increased based on the footer content height.

Following are the details of the functions that can be appended to the merge fields in the sections described above. The functions are case sensitive so please ensure to use in the same format described below. Most of the functions are already appended when merge fields are copied using Field pickers based on the field type but some functions. Few keywords like .Translate, Label Tags need to be typed manually.
| Function | Description | Supported Field Types | Example |
| .Date | Formats the Date & DateTime fields as per the format selected in the Date Format picklist above | Date DateTime | {!CreatedDate}.Date {!ExpirationDate}.Date |
| .DateTime | Formats the DateTime fields as per the format selected in the Date Format and Time Format picklists above | DateTime | {!CreatedDate}.DateTime |
| .Time | Formats the DateTime fields as per the format selected in the Time Format picklist above | DateTime | {!CreatedDate}.Time |
| .Currency | Formats Currency and Numeric fields to currency as per the logged-in user locale. If multi-currency org, it shows currency code (USD) otherwise shows currency symbol ($). (If you don’t want currency symbol, use .Number function instead) | Currency Number | {!TotalPrice}.Currency |
| .Number | Shows only the numeric value of the currency fields. This is helpful if you do not want to show currency code (USD) or currency symbol ($) | Currency | {!TotalPrice}.Number |
| .Checkbox | Shows checkbox for Boolean fields | Boolean | {!IsPrivate}.Checkbox |
| .Translate | Translates the field value as per Translation Workbench setting | Text Picklist | {!Status__c}.Translate |
| {!Label.MyCustomLabel} | Custom labels helps create multilingual documents by automatically presenting information in a user’s native language. For more information on Custom Labels, visit this link – https://help.salesforce.com/s/articleView?id=sf.cl_about.htm&type=5 | {!Label.Status} {!Label.ShippingAddress} {!Label.Quote} | |
| {!PageBreak} | Adds page break in PDF. Content after this tag will be shown on new page | Hello World! {!PageBreak} I am on new page! | |
| {!Today}.Date | Shows current date and time in the format selected in the Date Format picklist in Overall Style tab. | {!Today} {!Today}.Date | |
| {!PageNumber} | Shows page number as per the format selected in the Page Number Format picklist in Overall Style tab. | Page No.: {!PageNumber} | |
| {!GoCloudz.Attachment} | Show content dynamically based on business requirement using PDF Attachment feature. Please refer following section for more details on configuration of this feature. Note: It’s called PDF Attachment but it’s not used to attach or embed any PDF into generated PDF. | {!GoCloudz.Attachment1} {!GoCloudz.Attachment2} | |
| {!SignerRole.DocusignTag} | Signer tags specifies where the signer needs to take an action on the document. Applicable only if your DocuSign account is integrated with PDF Generator | {Signer1.SignHere} {!Signer1.Title} {!Signer2.DateSigned} |
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 in PDF template corresponds to one table in PDF. PDF Table consists of PDF Columns which correspond to individual columns in PDF.
Let’s check configuration options in more details.
If you have cloned pre-defined templates, you will get pre-configured tables and columns or you can create new tables and columns as per your need. Here are the fields for configuring the tables –
Title: This is displayed on top of the table as header & you can have headers like products, services etc.
Object Name: Select related Object 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 as well which is related to object selected in Object field in Overall Style tab.
QuoteLineItem, OpportunityLineItem & OrderItem are selected by default for standard Quote, Opportunity and Order Objects respectively.
Field Name: Select Object Field 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.
QuoteId, OpportunityId & OrderId are selected by default for standard Quote, Opportunity and Order Objects respectively.

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 :
(Custom_Field__c=” AND Product2.Family LIKE ‘%Subscription%’) – groups all line items where Custom_Field__c field is blank and Product family contains Subscription

Sort Column: Field API name to sort the table by. For example SortOrder for Quote. Defaults to CreatedDate if none provided.
Sort Order: Sorts table either by Ascending or Descending order. Defaults to Ascending if none provided.
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.

Title Style :
You can hide table title or change style by using following options –
Hide Title: When selected, it will hide the Title from the table.

Background Color, Title Align, Font Size and Font Color: These fields control the styling of Title/Header of the table
Additional Info:
It’s WYSIWYG editor and content of this field are displayed below the table & are tied to this table so if due to any reason table is not displayed content of this sections are not displayed as well. It is useful to have notes or pricing details specific to the table above.

Bundle View Configuration:
This section is visible only when our other Appexchange App CPQ/Product Bundle is installed in your org and you have access to it. These configurations are useful when you want to group items based on the Bundles & have Bundle level summary instead of individual line item summary. Please see PDF with Product Bundle for more details on how to configure tables with bundle summary.
PDF Columns need to defined for the fields to be displayed from related object as columns of the table in PDF. Please note, table will not be displayed unless there is a column defined.

Following are the PDF Column field details –
Choose Field : Every column corresponds to a field in related list object so we need to choose field corresponding to this column e.g., any standard field like Description, Quantity, SubTotal, Discount, TotalPrice etc. can be specified for QuoteLineItem related list or any custom fields can also be chosen.
Also, fields from related objects can also be chosen like product is having a lookup relationship with QuoteLineItem so any field from Product can be chosen as well.
You can also combine multiple field values in single PDF column and to do that use custom formula field to combine values of fields and use that choose that field formula field in the column e.g., to display product name and description from QuoteLineItem as single PDF column build a custom formula field on QuoteLineItem with this formula pricebookentry.Product2.Name & pricebookentry.Product2.Description or pricebookentry.Product2.Name & br() & pricebookentry.Product2.Description and choose that customer field.
Label : This will be automatically filled from the field name. You can modify as well.
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.

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.
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.
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.

Notes:

You can highlight negative values (number, percent, and currency fields) using custom color. For example, display all negative values in “Red”.
Go to PDF Settings tab > General Settings > Default Settings >> Enter the color code in “Highlight negative values” field

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 Columns and here is how aggregate values are shown below all the tables.

There are 2 very powerful features as part of Salesforce platform for storing translations – Translation Workbench and Custom Labels. Both of them are supported for creating multilingual templates. If you have users in various countries, we highly recommend using these features instead of creating separate template for each language/locale. This will save time managing multiple templates and also the translation will be consistent across Salesforce.
Please see this link for list of supported languages: https://help.salesforce.com/articleView?id=faq_getstart_what_languages_does.htm&type=5
For translating picklist field values in the PDF use this method.
First step is to configure Translation Workbench & please refer following article for details : https://help.salesforce.com/articleView?id=adding_and_editing_translated_languages.htm&type=5
Once Translation is setup for picklist values, use “.Translate” function which will pick the right translation as per User Language when PDF is rendered. Here is an example,

Above screenshot shows French translation for standard Opportunity Stage field. Please use below syntax in PDF Template –
{!Opportunity.Stage}.Translate
If you want to translate field labels or any custom text using the PDF Template, you need to use Custom Labels.
To access custom labels, from Setup, enter Custom Labels in the Quick Find box, then select Custom Labels. Please see this link for more information: https://help.salesforce.com/articleView?id=cl_about.htm&type=5
Here is an example,

Above screenshot shows default value in English and translation for French and Spanish. To show the text in user’s native language on the PDF, use notation as shown below:
{!Label.Hello}
You can also merge multiple labels and use that on the PDF. For example, consider label “Family_Diesel” which is combination of “Genwatt_Diesel_10k” and “Genwatt_Diesel_20k”. The value for “Family_Diesel” would be
{!Label.Genwatt_Diesel_10k} , {!Label.Genwatt_Diesel_20k}
Please note that translations setup using Labels or Translation Workbench will work based on User Language Settings –
As a template admin, you have option to preview a template for various locale and languages before activating for the end users.

In order to see languages in Language picker on this screen, you need to activate that language under PDF Settings tab > General Settings > Locale Settings and if any language is missing in the default list, please add a new Locale setting.
Only active languages are shown in the Language Picker when previewing a template as shown in the above screen.

Please skip this section if you are not using Product Bundle app. If you are using Product Bundle app, then you can show Bundle level summary instead of individual line item details like quantity, pricing etc.
Following are the steps to show Bundle Summary on the PDF –
PDF Table configuration:

PDF Column configuration:

Following are few examples of different Bundle views for the PDF Column configuration shown above –
Two Bundles added to Quote Line Item

If Bundle Format = blank in PDF Table configuration, bundles are shown as individual tables with bundle names printed as table headers

When Bundle Format = Tabular in PDF Table configuration, bundles are shown as rows of a table

If Bundle Format = Compare in PDF Table configuration, Bundle details are shown as columns of table

Once the templates are verified and activated, users can start using those templates to generate, save, download PDFs and email it to Recipients as attachment.
Create PDF & Email: End Users can go to the record , click ‘Create PDF and Email’ button, select appropriate PDF template, preview the PDF & email the PDFs as attachment to the recipients added to the record. In this option, PDF are be saved under Files and Notes & Attachment related list as well. This is good option to test new templates where users can preview the PDF before emailing to external recipients. Here is the step-by-step process for this option – Create PDF and Email
Create PDF: This option allows your users to just preview and save the PDF to Salesforce but not email it to the recipients. In this case, PDFs are saved under Files and Notes & Attachment related list. Here is the more details of this option – Create PDF
Download PDF: This option allows users to Download the PDF to desktop. This can be useful if you are generating lot of PDF documents and Salesforce storage is a constraint or if you have an external system/process for emailing the PDF documents. Here are more details of this option – Download PDF
Take advantage of PDF Rules to automate PDF Generation and Emailing. The rules will trigger based on record changes. For example, PDFs can be generated and emailed to Recipients when Opportunity is Close-Won or Quote is Approved. The PDF Template specified on the PDF Rule is used for generating the document and the email template specified on the PDF Rule is used for sending the email.
By default, the email address and the name for the email sent will be of the user who initiated the mail manually or through the automated process. You can configure the settings to show generic Name and Email. For example, “Company Name” and “accounts@company-name.com”
To specify the default values, go to PDF Settings tab > General Settings > Default Settings

This section provides details of PDF preview, creation & emailing as attachment end users. They can email the PDF to the recipients tied to the record, select on the email screen or enter email IDs in email screen.
2. By default all templates are shown to the end users but if you want to show relevant templates to the end users based on business rule, see Restrict/Filter Template to restrict or filter templates for end users.
3. If you want PDFs to be generated & emailed automatically, please see PDF Rules section on how to configure automation rules.
Lead, Quote, Opportunity & Order objects –
If you built template for one of these objects, we have provided a custom button named “Create PDF and Email” as part of the app. Please update page layout of respective object and add this button as mentioned below.
Other objects –
For other objects, create a custom button as per below details.
Create new button from “Button, Links and Actions” option on object setup page and fill the details as shown as below. This is the generic URL for the button where My_Object__c needs to be replaced with the object API name.
URL: /apex/sfcloud2__QuotePDF_Save?id={!My_Object__c.Id}&action=sendEmailFor example, if it’s standard Contact object, URL will be –
/apex/sfcloud2__QuotePDF_Save?id={!Contact.Id}&action=sendEmailIf it’s custom object with API Name Service_Object__c, URL will be –
/apex/sfcloud2__QuotePDF_Save?id={!Service_Order__c.Id}&action=sendEmail
Modifying Page Layout –
Next step is to modify the object page layout to add the button. For Classic view, add this button to custom button area in the page layout-

For Lightning view, please add the buttons to Mobile and Lightning Actions –

Recipients Configuration –
A lookup field is required to be created in Recipients object in order to configure Recipients. Please refer Recipients tutorial (last section) for details.
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.

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 to automatically add users as To, CC, or BCC.
Email Subject & Body can be populated by default. Please see the “Email Settings” section below to configure content for Subject and Body. Alternatively users can also select an approved email template with the merge fields. Click “Insert Email Template” button to see the list of all the approved email templates. Add Attachments (Classic) or Files (Lightning) linked to selected email templates will be automatically added to the “Attachment” sections
Click “Attach Files” button to upload any other documents to this email.

4. PDFs are stored under “Files” and “Notes & Attachments” section of the record.

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.

Go to PDF Settings tab > Object & Recipient Settings >> Object Configuration to provide default email subject and body for each object. You can also include merge fields to dynamically populate data from Salesforce record. Users will have an option to override the default subject and body when sending emails manually or sending the document for e-signature.

“Display Name” & “Reply Address” can be set for email recipients under PDF Settings tab > General Settings . For example, display name can be “GoCloudz Invoice” and reply address can be “sales@gocpq.com”. Please note, the emails are still sent using the logged-in user email address.
To send emails from a different email id, please configure “Organization-Wide-Addresses” (OWA) and use that same email address as “Reply Address” in the screen below. The display name will be picked up from the OWA too. Please see this link for more information on OWA – https://help.salesforce.com/s/articleView?id=sf.orgwide_email.htm

Create PDF allows end users to preview the PDF using the templates that the admin has made available & save it to Salesforce record under Files and Notes & Attachments related lists.
Below section walks through the configuration required for previewing & saving the PDFs.
As part of the app we have provided a custom button “Create PDF” for Lead, Quote, Opportunity and Order objects by default. For other objects, create a custom button as per below details.
Create new button from “Button, Links and Actions” option on object setup page and fill the details as shown as below. This is the generic URL for the button where My_Object__c needs to be replaced with the object API name.
URL: /apex/sfcloud2__QuotePDF_Save?id={!My_Object__c.Id}&action=saveFor example, if it’s standard Contact object, URL will be –
/apex/sfcloud2__QuotePDF_Save?id={!Contact.Id}&action=saveIf it’s custom object with API Name Service_Object__c, URL will be –
/apex/sfcloud2__QuotePDF_Save?id={!Service_Order__c.Id}&action=save
Next step is to modify the object page layout where PDF is to be generated to add the buttons.
For Classic view, add this button to custom button area in the page layout-
For Lightning view, please add the buttons to Mobile and Lightning Experience Actions –

Here are the steps end user (Sales Rep) will follow to preview and save PDF.
1. User clicks on Create PDF 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 save the PDF back to record using “Save PDF” button

3. 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.

Download PDF allows reps to preview the PDF & download it to desktop. It can also help reduce Salesforce storage if you are creating PDFs in bulk on regular basis.
Below section walks through the configuration required for downloading the PDFs.
As part of the app we have provided a custom button “Download PDF” for Lead, Quote, Opportunity and Order objects by default. For other objects, create a custom button as per below details.
Create new button from “Button, Links and Actions” option on object setup page and fill the details as shown as below. This is the generic URL for the button where My_Object__c needs to be replaced with the object API name.
URL: /apex/sfcloud2__QuotePDF_Save?id={!My_Object__c.Id}&action=downloadFor example, if it’s standard Contact object, URL will be –
/apex/sfcloud2__QuotePDF_Save?id={!Contact.Id}&action=downloadIf it’s custom object with API Name Service_Object__c, URL will be –
/apex/sfcloud2__QuotePDF_Save?id={!Service_Order__c.Id}&action=download
Next step is to modify the object page layout where PDF is to be generated to add the buttons.
For Classic view, add this button to custom button area in the page layout-
For Lightning view, please add the buttons to Mobile and Lightning Experience Actions –

Here are the steps end user (Sales Rep) will follow to preview and save PDF.
1. User clicks on Download PDF 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 download the PDF clicking “Download PDF” button. PDF will be stored in the local download folder depending on the browser settings.

This section walks through the configuration required to automate PDF process described in 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 clicking Create PDF button, then select a Template, and then Email. 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 the automation with internal users before enabling it for customers).
Please configure these one time settings.
Go to PDF Settings tab >> PDF Rules > Select “Auto Generate PDF” flag.
Select an object from the picklist to view all the rules for that object. Click “New” to configure a new rule or click the pencil icon to edit/view an existing one.

Sample PDF Rule

Object: Select the object the rule is applicable to
Field Name and Field Value: These fields define evaluation criteria for rule to fire. In above screenshot, the PDF will be generated when Opportunity StageName changes to “Closed Won”
Active: Select the checkbox to activate the rule
Name: Enter a name which is easy to recognize
PDF Template: The template that will be used to generate the PDF if the Field Name and Field Value match. List of available templates is filtered based on the Object selected
Email Template: The template that will be used to email the PDF to recipients. Note: Once an email template is provided, an email will be sent using this template. It is recommended to test the automation by providing an internal email id in the “Internal Email Id” field
Internal Email Id(s): Specify internal email IDs (separated by semi-colon) to test the automation before enabling it for the end customers. If populated, emails will be sent to the email ids specified and not to the Recipients. Once you have tested the automation, make this field blank to start sending emails to recipients
CC me and BCC me: If checked, the user who modified the record will be added as CC or BCC to the email sent to the recipients
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

You need to create following trigger in order to automate PDF generation for other objects than listed above.
trigger CreatePDF on My_Object__c (after insert, after update) {
if(UserInfo.isCurrentUserLicensed('sfcloud2') && !sfcloud2.QuotePDF_Utility.isTriggerRunning) {
//Copy default recipients
sfcloud2.QuotePDF_Utility.copyRecipient('My_Object__c', trigger.new);
//Create PDF and store as an attachment
sfcloud2.QuotePDF_Utility.createPDFAndEmail('My_Object__c', trigger.new);
}
}
Salesforce requires a test class with minimum 75% code coverage to deploy any code to production org. Please see sample test class below for the above trigger. You will have to modify below test class for it to work with the object you are configuring.
@isTest(SeeAllData=false)
private class createObjectPDF_TEST {
@testSetup
static void createData(){
//Create default PDF setting
sfcloud2__PDF__c pdfSettings = new sfcloud2__PDF__c(
Name = 'Default Configuration',
sfcloud2__Auto_Generate_PDF__c = true,
sfcloud2__Filter_Templates__c = false,
sfcloud2__Hide_Related_Objects__c = 'ProcessInstance,ProcessInstanceHistory,NetworkActivityAudit,ContentVersion'
);
insert pdfSettings;
//Create default Recipient setting
sfcloud2__Default_Recipients__c recipientSetting = new sfcloud2__Default_Recipients__c(
Name = 'My_Object_test',
sfcloud2__Object__c = 'My_Object__c',
sfcloud2__Receive_email_as__c = 'To',
sfcloud2__Primary__c = true,
sfcloud2__Recipient__c = 'Contact__c' //Replace this with the API name of the recipient field
);
insert recipientSetting;
//Depending on the object you will have to update below code to make sure all the required fields are accounted for
My_Object__c myObj = new My_Object__c (Name='TestRecipients');
insert myObj;
}
@isTest
static void validateData() {
My_Object__c myObj = [SELECT Id FROM My_Object__c
WHERE Name = 'TestRecipients' LIMIT 1];
//**Please make sure you have followed all the steps in the guide**//
//Below code will not compile if you have not created the lookup field on Recipients object
List<sfcloud2__Recipients__c> recipients = [SELECT Id FROM sfcloud2__Recipients__c
WHERE My_Object__c =:myObj.Id];
//Below assertion will fail if you have not configured the Recipient custom settings for the object
System.assertEquals(recipients.size()>0, true);
}
}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.
Go to the record, for example Opportunity and click “New” button on “Recipients” related list to add recipient(s) manually.

Field Definition –
Quote, Opportunity, and Order: Objects to which this recipient is related to. Please check below section for other objects
Lead, Contact, and User: These are lookup fields to the 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 displayed by default when sending emails using email templates with merge fields
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. It defines the sequence and the area where different signers will sign the document. Corresponding to each signer role, e-signature tags are placed on the PDF template
Check E-Signature section for more information on default recipients, email blurb and DocuSign account details.
Recipients can be added manually as shown above but this means less time for the reps for things that matter. Let’s see how recipients can be added automatically when a new record is created. This will not only save time but will ensure documents are sent to the correct recipient(s).
Object Settings

Go to PDF Settings tab > Object & Recipient Settings to define the object that needs to be configured. If the Object is already defined, you can go to the next step to configure the Recipients.
On the Object Settings, you can define below configuration that is applicable to all the PDFs generated for this object.
Object: The name of the object this setting applies to
Email Subject: Default email subject when PDF is emailed or sent for e-signature. Supports merge fields. Users can override before sending the email
Email Body: Default email body when PDF emailed or sent for e-signature. Supports merge fields. Users can override before sending the email
E-Signature Flow: Define how the PDFs are sent for e-signature to the recipients. It can be either Sequential or All at Once.
Recipients Settings
Go to PDF Settings tab > Object & Recipient Settings > Click on “Recipient Config” for specific object as shown above. Click the pencil icon to modify an existing recipient or click new to configure a new one. Recipient can be a Lead, Contact, or User field on existing object or the parent object. For example, standard Contact, Account & Opportunity Owners can selected as Recipients as shown below –

Recipient: The field which represents the recipient. It can be any User, Contact, or Lead lookup field
Receive email as: It can be To, CC, or BCC. Please note following –
Primary: Select Primary to merge this recipient information when emailing the PDF using Email Template
Signer Role: Applicable for e-signature only. Role identifies how the signers will receive the document and where they need to sign, initial, and enter other signer specific information.
Recipient object is pre-configured for standard Quote, Opportunity, and Order objects. Recipients needs to be configured for any other object. Here are the steps to do that –
1. Go to Setup >> Objects >> Recipients >> Create a new Custom Lookup field
2. In the “Related To” field select the object the PDF is being created for

3. 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

4. Add Recipients related list by editing My_Object page layout.
5. Follow steps mentioned in the “Recipient Automation” section above to automatically create recipients for this object
6. Finally, create an Apex Trigger similar to below
trigger CreatePDF on My_Object__c (after insert, after update) {
if(UserInfo.isCurrentUserLicensed('sfcloud2') && !sfcloud2.QuotePDF_Utility.isTriggerRunning) {
//Copy default recipients
sfcloud2.QuotePDF_Utility.copyRecipient('My_Object__c', trigger.new);
//Create PDF and store as an attachment
sfcloud2.QuotePDF_Utility.createPDFAndEmail('My_Object__c', trigger.new);
}
}
Salesforce requires a test class with minimum 75% code coverage to deploy any code to production org. Please see sample test class below for the above trigger. You will have to modify below test class for it to work with the object you are configuring.
@isTest(SeeAllData=false)
private class createObjectPDF_TEST {
@testSetup
static void createData(){
//Create default PDF setting
sfcloud2__PDF__c pdfSettings = new sfcloud2__PDF__c(
Name = 'Default Configuration',
sfcloud2__Auto_Generate_PDF__c = true,
sfcloud2__Filter_Templates__c = false,
sfcloud2__Hide_Related_Objects__c = 'ProcessInstance,ProcessInstanceHistory,NetworkActivityAudit,ContentVersion'
);
insert pdfSettings;
//Create default Recipient setting
sfcloud2__Default_Recipients__c recipientSetting = new sfcloud2__Default_Recipients__c(
Name = 'My_Object_test',
sfcloud2__Object__c = 'My_Object__c',
sfcloud2__Receive_email_as__c = 'To',
sfcloud2__Primary__c = true,
sfcloud2__Recipient__c = 'Contact__c' //Replace this with the API name of the recipient field
);
insert recipientSetting;
//Depending on the object you will have to update below code to make sure all the required fields are accounted for
My_Object__c myObj = new My_Object__c (Name='TestRecipients');
insert myObj;
}
@isTest
static void validateData() {
My_Object__c myObj = [SELECT Id FROM My_Object__c
WHERE Name = 'TestRecipients' LIMIT 1];
//**Please make sure you have followed all the steps in the guide**//
//Below code will not compile if you have not created the lookup field on Recipients object
List<sfcloud2__Recipients__c> recipients = [SELECT Id FROM sfcloud2__Recipients__c
WHERE My_Object__c =:myObj.Id];
//Below assertion will fail if you have not configured the Recipient custom settings for the object
System.assertEquals(recipients.size()>0, true);
}
}Following are the key benefits of integrating DocuSign with PDF Generator –
Pre-Requisite:
Following are the steps DocuSign integration –
Connect DocuSign and Salesforce as per this tutorial [Only 1 to 3 steps are needed for eSignature] –
https://success.docusign.com/gen-negotiate/checklist/gen#step-2
(This is the managed package link mentioned in the tutorial – https://appexchange.salesforce.com/appxListingDetail?listingId=a0N30000001taX4EAI)
Please ensure that the user account used to connect DocuSign is assigned a PDF Generator license else you won’t be able to see objects/fields specified in next steps.

From DocuSign Admin, configure objects based on the object being used in PDF Templates. For example, if PDF Template has been designed for Quote, configure only Quote here but if it’s designed for multiple objects like Quote and Opportunity, configure it for both objects as shown below. It can be custom object as well.

Below is the configuration for the individual object. envelope IDs need to be mapped between Salesforce & DocuSign.

If “Envelope Id” field does not exist, please create one in your Salesforce org for that object. It can be Text (100) data type.
Once above configurations are completed in DocuSign, next step is to configure Salesforce Org which is connected to DocuSign.
1. Go to PDF Settings tab > DocuSign Settings to configure DocuSign related information.
Enter DocuSign information under “Account Info” section. This account will be used for authentication purpose. You can get following details by logging into your DocuSign portal under API and Keys in left menu.
Notes :
API Username (Salesforce) -> User ID (DocuSign)
Account Id (Salesforce) -> API Account ID (DocuSign)
3. For Endpoint use following URLs –
If connected to demo account of DS – https://demo.docusign.net/api/3.0/dsapi.asmx
If connected to Production account of DS – https://www.docusign.net/api/3.0/dsapi.asmx

2. Add this user details under User Info as well –

Optionally, you can configure additional DocuSign users under “User Info” section who are also PDF Generator user in Salesforce, if document needs to be generated and sent as that user. In this case, From email will show that user name. If users are not added here, email will be sent using account setup in the step above.
There are 3 options for location

3. Recipients & Email settings : Go to Recipients tutorial & check ‘Recipient Automation’ section to personalize default e-signature email subject and body for respective object when users receive the email from DocuSign.
You can also configure to automatically add recipients and how they receive the document.
4. Add DocuSign tags in PDF Templates where recipient is supposed to sign and put other details as per this tutorial – DocuSign Standard and Custom Tags
5. Add following components on the page layout of the respective object
a. “Create PDF and E-Signature” button/action
b. “Recipients” and “DocuSign Status” related lists
6. Optionally, you can enable Multi-Factor authentication so that recipients will have to authenticate before signing the document. Please see Multi-Factor Authentication (MFA) for more details.
You are now ready to test. Please check this tutorial for the end user experience.
If you are using e-Signature feature for any object other than Account & Opportunity, following are the additional steps required in order for “DocuSign Status” related list to populate under that object –
1. Create custom lookup field in the DocuSign Status object, which is a custom object provided as part of the DocuSign package.

2. Add field mapping in DocuSign for “dsfs_Docusign_Status__c” connect object –
For Quote Object:

DocuSign has reserved fields for certain standard objects only. For all other standard and all custom objects, use the “Envelope External Source Id” field to map to the lookup field created above in step 1. Assuming the lookup field was created for the standard Order object in step 1 above, below screenshot shows how to map the field.

Create a custom button with below URL like we did for email feature. Replace My_Object__c with the API name of the object
Name: Create PDF and E-Signature
URL: /apex/sfcloud2__QuotePDF_Save?id={!My_Object__c.Id}&action=sendForESignatureDocuSign tags clearly indicate locations on a document where your recipient (signer) needs to take an action. You can easily add digital signatures, initial, and use other information tags so your recipients (signers) know precisely where to sign, initial the document, or enter information as per the tag.
* Attachment tag allows sender to request additional supporting information to the document. These attachments are uploaded to the DocuSign system and shared with the sender and any other signers or viewers on the document.
Attached items are converted to a PDF and must be under 25 MB in size. For more information on supported attachments, see Supported File Formats.
You can now add custom tags to your PDF template, define properties for each one, all within Salesforce. All of your custom tags will be captured by DocuSign and will be visible under Form Data.
Go to PDF Settings tab > DocuSign Settings > Custom Fields to configure the custom fields. Once you configure them in Salesforce, you do not have to configure them in DocuSign.

Name: The name will be shown as mouse hover on the PDF. It will also be stored as field name under Form Data in DocuSign
Type: Select the type of the field
List Item: Semi colon separated values for field of type List
Radio Group Name: Enter same name to group multiple radio items
Max length: Maximum characters users can enter in the field
Width: The width of the field
Required: Is this field required on the PDF. Not applicable for checkbox type
Once the fields are defined, you can add those fields anywhere on the template. Please see below snippet on how to add the tags for Signer 1. Similarly, tags can be added for Signer 2, 3, and 4.
----------- Standard Tags -----------
Full name: <span style="color:white">{!Signer1.FullName}</span>
First name: <span style="color:white">{!Signer1.FirstName}</span>
Last name: <span style="color:white">{!Signer1.LastName}</span>
Title: <span style="color:white">{!Signer1.Title}</span>
Email: <span style="color:white">{!Signer1.EmailAddress}</span>
Date Signed: <span style="color:white">{!Signer1.DateSigned}</span>
Initial: <span style="color:white">{!Signer1.InitialHere}</span>
Sign: <span style="color:white">{!Signer1.SignHere}</span>
Attachment Mandatory: <span style="color:white">{!Signer1.SignerAttachment}</span>
Attachment Optional: <span style="color:white">{!Signer1.SignerAttachmentOptional}</span>----------- Custom Tags -----------
Department: <span style="color:white">{!Signer1.Department}</span>
Email: <span style="color:white">{!Signer1.Email}</span>
Joining Date: <span style="color:white">{!Signer1.JoiningDate}</span>
NotifyMe: <span style="color:white">{!Signer1.NotifyMe}</span>
Salary: <span style="color:white">{!Signer1.Salary}</span>
Size: M: <span style="color:white">{!Signer1.Size_M}</span> L: <span style="color:white">{!Signer1.Size_L}</span>
State: <span style="color:white">{!Signer1.State}</span>

Once e-signature is configured, users can breeze through when sending the PDFs for e-signature. Following are the steps end user/rep needs to follow in order to send PDF for e-signature and track the status within Salesforce –
1. Enter details for each recipient. Please see “Recipient” section on how to automate the recipients.
Signer Role: Identifies where the user needs to sign on the PDF and the order in which the document should be received for e-signature. The e-signature tags are stored on the PDF template

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. User is presented with a screen to enter the Subject and Body of the email and to verify the signers/recipients. Please see Object Settings. on how to provide default Email Subject and Email Body

6. Click “Send” to send the PDF to the signers. User will be redirected back to the record
7. PDF is saved under Note & Attachments related list, Recipients will receive an email like below from DocuSign
8. Track status in real time using the DocuSign Status related list.

Sometimes you may want to attach additional documents along with the PDF for your recipients to review and/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.

For enhanced security you can setup Multi Factor Authentication (MFA) for DocuSign requiring each recipient to provide additional information to prove their identify. This is an optional feature. Configure MFA only if your business use case requires higher level of threshold for dealing with any sensitive data.
Go to PDF Settings tab > DocuSign Settings to configure MFA for all the envelopes that gets sent using DocuSign.

Authentication (MFA)
The phone number used for authentication is based on the phone and mobile number entered in Salesforce (Lead, Contact, or User). Both the phone numbers are visible on the Recipient related list. You can also select “Recipient may specify phone number” which allows the recipient to enter a phone number of their choice for authentication purpose. It is not recommend to select this option as the signer may enter a phone number different than what is specified in Salesforce.

Once MFA is configured successfully, all recipients must identify themselves before viewing the documents. They will see a screen similar to below where they can select the number corresponding to what they have in Salesforce or enter one. The signer has three chances to enter the code correctly.

By default all active templates are available to end users for generating PDF. Depending on the business scenario, you may want 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. This is the same PDF Rules object we have configured previously, so all you have to do is enable below settings to restrict what templates users can use based on those rules defined.
Go to PDF Settings tab > PDF Rules > “Filter Templates” flag.

In many cases you may want to including certain information conditionally in PDFs, e.g. T&C based on specific region or quote type. At the same time you don’t want to copy that information in individual records and want to keep it in a common place. To handle these scenarios we have provided 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.
It’s 3 step process and following are the details –
Step 1
Go to PDF Attachments tab and click “New” to define attachment details –
Object: Select the object to which the dynamic content is applicable to
Attachment Name: Provide user friendly name
Description: Provide description that explains the content. It is optional
Content: There are 3 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

Step 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.Attachment1} and {!GoCloudz.Attachment2}

Step 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

Flows 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.
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.

You may have images to show on Header, Title, T&C or Footer sections or you may show the product images on line item level. Below is the explanation of how to work with images for both the scenarios –
Images to be shown on Header, Title, T&C or Footer sections –
You can upload the images from your location PC using WYSIWYG editor Image option and can change image attributes like image size by right clicking the images after it’s uploaded and selecting Image option like shown below –


Images to be shown for Product Line Items –
In many cases you may have images for individual Products which you want to show in the PDF Tables. To make it easier to show the images on Tables, you can create 2 custom fields – Image URL (On Product Object) and Image Formula field on Objects like Quote Line Item, Opportunity Product etc.
Recommended practice is to store the individual images under Static Resources and specify the image URL into Image URL field on Product level.

Image Formula will look like following –
IF(
PricebookEntry.Product2.sfcloud__Image_URL__c ==”,
‘Image Unavailable’,
IMAGE( PricebookEntry.Product2.sfcloud__Image_URL__c , “Image Unavailable”, 75, 75)
)
You can use this Image formula field as PDF Column which will render the images into PDF –

You can also change height/width in this formula field.
For Images stored outside of Salesforce –
In some case images are stored in external repositories and in order to avoid duplication you may want to use external image. In those scenarios, one additional step needed is to add domain where image is stored as Remote Site Settings –
– Go to Setup menu > Administer > Security Controls > Remote Site Settings > New
– Enter remote site name, URL (For example, http://MyURL.com), mark it Active and click Save
