Before you work with this guide, make sure you've installed PandaDoc for Salesforce, please click here and follow all steps.
Note, if you created a “Custom Object” in Salesforce and you want to add the PandaDoc module to it, you will need go through the steps for each Custom Object.
Salesforce Versions for Custom Objects: You will need Salesforce: “Enterprise”, “Unlimited”, or “Developer edition”.
For developers, click here to find detailed documentation with code examples on how to add custom objects to your Salesforce-PandaDoc integration.
Add the PandaDoc module to Custom Objects
PandaDoc will look for a custom JSON builder for your custom object to serialize the Custom Object’s data and pass it to PandaDoc when you create a document from your Custom Object’s page.
With the new version, PandaDoc allows you to quickly setup PandaDoc module for a custom Salesforce object using the predefined JSON Builder. You will have the option to pull Pricing items and Recipients into a PandaDoc document.
If are using an older integration version or you’d like to set up a more customizable option, please see the detailed documentation attached at the end of the article.
On the top bar, click “+” and select “PandaDoc Setup”;
At the bottom you will find the JSON builder settings, click “Add PandaDoc to Custom object”. The system will prompt you to select the custom object that you want to connect PandaDoc with.
Create a VisualForce Page for the Custom Object
To embed the PandaDoc module your custom object pages, you will need to create a VisualForce component and add it to custom object’s page layout.
Go to Setup > Develop > Visualforce Pages and click on “New” to add a new Visualforce page;
Enter a Visualforce Label and Name for your page;
Follow the link and copy the source of the Visaulforce template and paste it into the “Visualforce Markup” section of the page settings: https://github.com/PandaDoc/pandadoc-sfdc-examples/blob/master/examples/force-app/main/default/pages/PandaDocForCustomObject.page
Replace the following value in the template with your object name which you can find in JSON Builder Settings section, in the Object Name column:
Line 1:
standardController="CustomObject__c"
Save the Visualforce page.
Insert the Visualforce page into your Custom Object view
Go to Setup > Create > Custom Objects, and select your Custom Object from the list of Custom Objects;
Scroll down to “Page Layouts” and select “Edit” to edit your Custom Object’s page layout. From “Fields” select “Section” and drag a new section into your page layout;
Name the section and select a 1-Column layout. Then select “OK”;
From “Visualforce Pages” select your Custom Object Visualforce Page and drag the page into the Section you just created;
Save the layout.
Your Custom Object layout will now have PandaDoc documents in the view that are associated with each Custom Object record.
Pass data from SFDC into PandaDoc
In order to pass data from Salesforce to PandaDoc document, first you should create your template and set it up with Tokens (same as Merge Fields). Learn more about tokens here.
Important information about tokens: Although tokens can automatically populate information in your document, they can only be added/edited in templates, not documents.
Note:
If you want to pass data to PandaDoc which would be editable for Recipients, refer to the paragraphs below with the prefix “(via Fields)”.
Passing Salesforce fields into PandaDoc (via tokens)
Before setting up your template with tokens, create a tokens list for the custom object you will use PandaDoc with.
Note:
Tokens must be setup for each object individually. Only the tokens listed in that particular object will be available when creating a document from it (no cross-object population.)
For that, click “+” and go to Pandadoc Setup. Scroll down to “Salesforce to PandaDoc data flow” and click “Configure objects”;
Next, click “Add object” and choose your custom object;
You will see a default list of tokens on the right. To add more, check the fields you want to add to the tokens list and click “Save”;
Open your PandaDoc template in a separate browser window, copy & paste token names with the square brackets into the template.
When you create a document from Salesforce using this template, the tokens will be filled out with the information from the CRM.
You can also review the list of tokens along with the data that will be passed in the Salesforce record.
Open a Salesforce record, scroll down to PandaDoc, click the gear icon in the top right corner of the module and choose Tokens/Variables - this is what you can pass;
Open your PandaDoc template in a separate browser window, copy & paste Token names with the square brackets into the template.
Note:
In case the field in Salesforce is empty, the Token/Variable in the document will not be populated and you will have to fill it in manually.
Passing Salesforce fields into PandaDoc (via Fields)
You can pass data into PandaDoc fields similarly to how variables operate. Unlike with variables, however, you don’t need to include square brackets.
In the list of tokens, copy the token without square brackets into Merge field.
Once the document has been sent, the recipient will see the pre-filled data and be able to update this field, provided the field has been assigned to them.
Configure passing recipients and pricing items data into PandaDoc
Now you should set up lookup relationship for your custom object:
In JSON builder settings under Actions select “Setup”;
Configure Related Pricing Items and Recipients by selecting lookup relationship for them;.
Once you select and saved the Related Items, the information about Pricing items and Recipients will be automatically pulled into a PandaDoc document created from your custom object.