Use Case #4: Complete Fields on a File

As you upload a single file, update standard and custom fields on ContentVersion while in the flow. This post is part of the Uploading and Working with Files in Flow mini series.

Ingredients:

  • Install/setup flow package
  • Flow: E01_004_CompleteFieldsOnAFile
  • Standard File Upload flow screen component (included in the flow)
  • Case object – need at least one case record in your org

Video Tutorial (1.75 min)

What’s Happening in the Flow:

  1. This flow is just like the “Rename an Uploaded File” sample flow, but we’ll update some additional fields on the latest ContentVersion instead.
  2. For this sample flow, I’ve created a custom field on the ContentVersion object called “Document Type” (included in the unmanaged package). It’s a picklist we’ll use and update in the flow. And for giggles, we’ll also update the standard Description field and the Title field from the last sample.
  3. “Upload a Single File” element: I’ve added Document Type and Description fields to the screen for the user to complete.
  4. But I’ve also used conditional visibility to hide File Upload and Description until the user selects a Document Type. Cool, huh? I find that this provides an easier-to-follow user experience.
  5. “Update Content Version” element: To get to our custom field, we have to directly update the latest ContentVersion record (not ContentDocument like we did in the previous sample). But lucky for us, the ContentVersion record Ids are also available as outputs from the File Upload component.
    1. Instead of hard-coding a silly new Title for our file like before, I use a Text Template resource called templateTitle to pull together values available to the flow to create a standard naming convention for our files. You can also use a formula variable to do this, but text templates are easier (they have less syntax to worry about).
    2. Document Type and Description get set from the values selected or provided by the user on the previous screen.
  6. That’s it! So not only do you get a cool sample flow, but you also get some freebie examples of using Conditional Visibility for screen components and using Text Template resources to create dynamically-generated field values!

Please review Some Limits for caveats related to this particular use case.


2 thoughts on “Use Case #4: Complete Fields on a File

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: