FT Doc Gen Button for Salesforce Document Generation

Business Background

Create the FT Document Generation button and add it to your page layout in Salesforce. In most standard objects, the FT buttons are created automatically for you by Titan; however, if you want to add an FT button to a custom object page for Salesforce document generation, you must first create the button and then add it to the layout.

Titan Solution

Add the FT Doc Gen button to your object.

There are two types of FT Doc Gen buttons you can add:

  • The Detail Page button is added to the record page.
  • The List View button is added to the List view page. You can select multiple records and use the button for all the records.

How to Video

Coming soon.

How to Guide

Note:

Prerequisite:

1. On the Titan Forms project, make sure that you configure the Word mapping.

2. Click the Configure button under the Salesforce button.

This image has an empty alt attribute; its file name is image-497.png

3. Select an object and map the record ID to the Form.

This image has an empty alt attribute; its file name is image-527.png

Detail page button

Add the button to the record view in an object.

  1. Open the object where you want to add the FT Doc Gen button.
    • In this example, the Contacts object is used.
  2. Click the Gear icon and select the Edit Object option.
Edit Salesforce object
Edit Salesforce object
  1. Select the Buttons, Links and Actions option and click the New Action button.
New Action button
New Action button
  1. Use the Action Type drop-down list to select the Lightning Component option.
  2. Use the Lightning Component drop-down list to select the Form_Builder:FTGeneratePDF option.
  3. Change the height of the modal. We recommend that you set the height to 780px.
  4. Add a Label in the field. This is the button label that the user will see.
  5. Add a Name in the field. This is the API (system) name.
  6. Click the Save button.
New Action screen
New Action screen
  1. View the new action added and click on the Object Manager tab.
Object Manager tab
Object Manager tab
  1. Select the Page Layout option for the object and click the Mobile & Lightning Actions option. The newly added button is in the list for Salesforce document generation.
Mobile & Lightning Actions option
Mobile & Lightning Actions option
  1. Drag and drop the new button to the Salesforce Mobile and Lightning Experience section and click the Save button.
Salesforce Mobile and Lightning Experience section
Salesforce Mobile and Lightning Experience section
  1. Refresh the Contacts page and select a specific contact in the list. The new button has been added to the record.
Button added
Button added

When the user clicks the button, the Document Generation modal opens with a list of the templates to which the specific user has access.

Document Generation modal
Document Generation modal
Note:

The height of the modal in this example is 780 px.

List View button

Add the button to the List View.

  1. Open the object where you want to add the FT Doc Gen button.
  2. Click the Gear icon and select the Edit Object option.
Edit Salesforce object
Edit Salesforce object

Create a new button

Create a Visual Force Page

  1. On the Home tab, search for “visualforce” and click the Visualforce Pages option.
Visualforce Pages option
Visualforce Pages option
  1. Click on the New button to create a new Visualforce Page.
New button
New button
  1. Copy the code below.
<apex:page standardController="yourCustomObjApiName__c" recordSetVar="recVar" sidebar="true" lightningStylesheets="true" >
   <apex:includeLightning />
   <apex:form >
    <apex:pageBlock title="Generate Multiple PDF" >
       <apex:pageBlockButtons location="top">
            <apex:commandButton value="Back" action="{!cancel}"/>
        </apex:pageBlockButtons>
        <apex:outputText rendered="{!IF( selected ='' ,true,false)}">
            <apex:pageMessage severity="error" strength="1" summary="{!$Label.form_builder__please_choose_at_least_1_record}" />
        </apex:outputText>
    </apex:pageBlock>
    <div id="lightning" />
        <script>
            var recids = '{!selected}';
            recids = recids.replace(']','');
            recids = recids.replace('[','');
            recids =  recids.replace(/\s/g, '');
            if(recids.length>0){
                $Lightning.use("Form_Builder:FTPDF", function() {
                 $Lightning.createComponent("Form_Builder:FTGeneratePDF",
                  { recids : recids }, "lightning",
                  function(cmp) {});
                });
            }
        </script>
    </apex:form>
</apex:page>
  1. Delete the default code and paste the code you copied from above in the field.
Visualforce Page (default code)
Visualforce Page (default code)
  1. Add a Label in the field. This is the button label that the user will see.
  2. Add a Name in the field. This is the API (system) name. The API name must have underscores (_) instead of spaces between words.
  3. Click the Available for Lightning Experience, Experience Builder sites, and the mobile app checkbox.
  4. Change the “yourCustomObjApiName__c” field to the name of your custom object, for instance, “Birthdays__c.”
Note:

Makes sure that you use the API name of the custom object and not the name.

  1. Click the Save button.
Visualforce Page (pasted code)
Visualforce Page (pasted code)
  1. View the new Visualforce Page and click the Object Manager tab.
New Visualforce Page
New Visualforce Page

Create a button from the Visualforce Page

  1. Search for your custom object.
  2. Select the Buttons, Links and Actions option on the custom object and click the New Button or Link button.
Buttons, Links and Actions option
Buttons, Links and Actions option
  1. Add a Label in the field. This is the button label that the user will see.
  2. Add a Name in the field. This is the API (system) name. The API name must have underscores (_) instead of spaces between words.
  3. Select the List Button radio button.
  4. Use the Content Source drop-down list to select the Visual Page option.
  5. Use the Content drop-down list to select the Visual Page name if you have more than one VisualForce Page relevant to this custom object.
  6. Click the Save button.
New Button or Link
New Button or Link

Add the button to the Layout

After you have created a new button, it will be available in the list to select. Buttons that are part of the Titan package will also be listed here.

  1. Select the List View Button Layout option and use the drop-down arrow to access the Edit option.
List View Button Layout option
List View Button Layout option
  1. Under Available Buttons, click the button that you added with a Visualforce Page and select the arrow icon to move it to the right. The button is moved to Selected Buttons.
  2. Click the Save button.
Available buttons
Available buttons

The button is added to the List View layout.

Button added to List View
Button added to List View

You can now use the button on the object.

Button added to object
Button added to object

If you cannot see the button in Salesforce, use the drop-down arrow and click on the FT Doc Gen option.

FT Doc Gen option
FT Doc Gen option

If you are interested, check out our Salesforce document generation article for a comparison of the 10 best tools in the market.

Hidden Title

Need more help?