1

I am using lightning:fileUpload component in flows embedded on community page. I want to make this mandatory/ required so that the user sees an error if they click next without uploading a file. I have tried creating a custom footer component and passing attributes from file upload component to validate but not sure how I can display error. Is there any other way to make lightning:fileUpload required in flows ? Thank you.

3 Answers 3

2

I've used a workaround that uses a "Decision" if there is no file attached. If the file ID I am passing through is blank, I have it show a screen that informs them a file is required and then takes them back to the file upload. Hoping they will come out with a way to do this without the workaround!

1

You might try creating a wrapper component for lightning:fileUpload that exposes a validate method. The method could check if the user has uploaded anything and return the custom error message.

Here is more info on the validation method: https://releasenotes.docs.salesforce.com/en-us/winter19/release-notes/rn_forcecom_flow_validate_attribute.htm

0

Checking if the ID is blank, null or empty, didn't work for me. Similar to this reddit: https://www.reddit.com/r/salesforce/comments/lffnuv/salesforce_file_upload_in_flow/?rdt=54030

I was able to solve it by getting the count of contentDocIds, and if count of contentDocIds = 0, then do whatever. Here's how I did it:

  1. Create a new resource variable with data type Number (let's call it contentDocIds_Count)

create_var

  1. Add an Assignment element and set contentDocIds_Count to Equals Count {!Your_File_Upload_API_Name.contentDocIds}

set_var

  1. Add a Decision element, and in it, add a condition that checks if contentDocIds_Count Equals 0

enter image description here

With these threein place, I was able to direct the user to another Screen element prompting them to add the missing files.

flow

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .