1. Help
  2. Salesforce
  3. Create PDFs

Attach PDFs to Salesforce Records

Introduction

In this tutorial, we will create a new case form which will:

  1. Generate a PDF document based on the form data.
  2. Create a new case in Salesforce.
  3. Attach the PDF to the new case.

Create a new form

On your Formcrafts dashboard click on Add Form → Start from scratch. Enter a Form name and hit enter. This will create a new form.

You can also create a new form by clicking on Add Form → Use a Template and selecting a template. This would allow you to skip this step.

Now add some basic fields to your form using the Add field button on the top-left corner of the form editor:

  1. Your name (One line text)
  2. Your email (Email)
  3. Your comments (Comment)
Salesforce create case form

Create a PDF action

Click on the Workflows button on the top-left corner of the form editor, and then click on the Add workflow button.

Now edit the new workflow, and click on Add action. Under (select action) find Create PDF.

Under PDF name type: case_@Your name.

This workflow will create a PDF document with the name case_ followed by the value of the Your name field.

Create PDF workflow

Create a case action

Click on Add action to add another action to this workflow. Under (select action) find Salesforce, and click on Connect to Salesforce.

Connect to Salesforce organization

This will open a popup window where you can connect to your Salesforce organization.

Configure a Create a Case action, and accordingly map the form fields to Salesforce fields:

Salesforce create case workflow
Create case workflow

Create a content version action

Click on Add action to add another action to this workflow, and find Salesforce under (select action).

In this action we will upload the PDF file (create in the first workflow) to the new case (created in the second workflow).

Configure this action to Create a Content Version, as follows:

Salesforce create contant version workflow
Create content version

We have mapped the PDF #1 reference to Version Data. This will upload the PDF file to Salesforce.

We have mapped Salesforce Case #2 to First Published Location ID. This will attach the PDF to the new case, available under Notes & Attachments.

Save and test

Click on the Preview button on the top-right corner of the form editor, and submit the form to test the workflow.

Formcrafts keeps a record of all successful and failed workflows which you can view using the Logs button on the top-left corner of the form editor.

Learn more about Workflow logs.

Workflow logs panel in Formcrafts