Salesforce Obscura: Auto-copy a File to a Rich Text Field with FormAssembly

Option 1 of 2 — using FormAssembly to upload the file

Need to have your student or participant headshots appear automatically in a rich text field? Easy!

Example Use Case and Solution Overview

For this article, we tackle a very common request from our clients: getting an external party (say, a student applicant to a youth program) to upload their own photo and displaying that photo in a rich text field for internal users to view and use.

  1. Prepare the Contact record with a Rich Text field to display the photo and a field to trigger the Flow
  2. Create a Flow that responds to a change on Contact to populate the Rich Text Field
    (2a) Create a new flow on Contact
    (2b) New Resource->Variable: TypeOfFile
    (2c) New Resource->Formula: DocumentURL
    Getting the URL for the Image tag
    (2d) Decision: Photo ID Is Not Blank
    (2e) Get Records on the “Yes” path from the decision: Find CV Data
    (2f) Update Record: Update Photo
    (2g) Save and Activate Your Flow
  3. Create the FormAssembly form to capture the file upload
  4. Create the FormAssembly connector to store the information in Salesforce
    (4a) Create new ContentVersion Record
    (4b) Update the Contact Record to store the ContentVersion ID

(Step 1) Create 2 new fields on your object.

  • A text field, 18 characters long, to contain the ID of the file you will upload. I called mine “Photo CV ID”
  • A rich text field to display the photo itself. I called mine “Photo” and just took the defaults for a rich text field.
Two new fields — one for the ID, one rich text, on your target object

(Step 2) Create a Flow to respond to your ID field and populate your Photo field

My flow is simple, for demonstration purposes. It starts by asking if the Photo CV ID is not null but the Photo field is. If that’s the case, it goes off to find the file type from the Content Version (using the ID in the Photo CV ID field) and then updates the Photo field with a formula that brings it all together.

A simple Flow that asks if the photo ID is available, and if so, finds the other data needed and updates the rich text field.
Create a new variable to store the file type.
  • If you just copy/paste the formula below, make sure you adjust {!$Record.Photo_CV_ID__c} to match your actual custom field name
  • Replace REPLACEME below with your actual domain. From any record page, just grab the part of the URL before “”
The part in red is what I would put in place of REPLACEME below. Your URL is unique to your Salesforce instance.
My formula edit — showing the data type of Text and the way the formula looks in the Resource editor.
  1. Manually upload an image file to a Contact record
  2. Click on the file to open it in the File Preview. Right click (command+click on mac) and copy the preview to my clipboard.
  3. Paste from my clipboard into a Rich Text field on Contact and save my changes.
  4. Use to export only the record I’m testing with, and only my rich text field. The html for the working, pasted image will show up in plain text in the export, allowing you to mimic it in this formula field.
$Record refers to the field on the Contact record that started this flow. We are testing whether our key fields are blank or not, to know if we need to take the next step.
  • Get Records of this Object: Content Version
  • Filter Content Version Records: Where ID equals $Record->Photo CV ID
  • How many records to store: Only the first record
  • How to store record data: Choose fields and assign variables (advanced)
  • Where to store field values: In separate variables
  • Set your variable to store the value FileType in your variable TypeOfFile
Get the Content Version record and store its FieldType in your custom variable.
  • Use the record that created the flow
  • Set Filter Conditions: None — Always Update The Record
  • Set Field Values For the Record: Set your rich text field equal to the formula field you created in (2c)
Update the instantiating record’s rich text field with the formula

(Step 3) Create your FormAssembly Form

For this example we have a very simple form that has a file uploader and a hidden Contact ID field. We would prefill the Contact ID field with the Contact ID from Salesforce but you can also put enough information to look up the Contact. As with Flows, this tutorial isn’t really able to go too far into exactly how to set up a FormAssembly form — the goal is just to ensure you can attach a File to the right Contact and get the ContentVersion ID.

Our simple form has a File Uploader and a hidden Content ID field.

(Step 4) Create your FormAssembly Connector

Connect your FormAssembly form to Salesforce with an After Form Submitted connector. You will first create the file upload, then use the ID from the uploaded file to fill in your Contact field.

In FormAssembly connectors, create a new ContentVersion record.
Set Photo CV ID to the ID of the object you created in step (4a)

(Step 5) Save your form and test it all out

Upload a file to your FormAssembly form, and you should get:

  • A File attached to the Contact record for which you provided the prefilled ID
  • A value in the Photo CV ID field
  • A 200x200 view of your file in your rich text Photo field
Pictured above: The attached file, the Photo CV ID and the uploaded photo in your rich text field



Operationalizationer — one who defines a fuzzy concept so it becomes clear, measurable, and empirically observable. Founder @

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jenn Taylor

Operationalizationer — one who defines a fuzzy concept so it becomes clear, measurable, and empirically observable. Founder @