Attach PDFs to Salesforce Records
Introduction
In this tutorial, we will create a new case form which will:
- Generate a PDF document based on the form data.
- Create a new case in Salesforce.
- 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:
- Your name (One line text)
- Your email (Email)
- Your comments (Comment)
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 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.
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:
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:
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.