Uploading Files through Screen Flow is a bit tricky. We can’t use ‘Create Record’ element like we can for creating other records. And then we can’t even make the file upload mandatory like we can make other fields mandatory in Screen Flow.
This is a question that was asked by one of our Mastering Salesforce Flows course participants and since the solution is not very straight forward, we thought of documenting the whole solution in a step-by-step guide format and share with everyone.
Here’s the business requirement
- Create a Flow to create a record with Attachments (Files)
- Make the file upload mandatory
- If the user does not upload the file, then delete the record that was created
And here is the Flow design. Step-by-step with screenshots.
NOTE: Certain sections of the guide will appear as locked in the free preview. You can download the unlocked version of the guide in PDF format by subscribing to our “All Access” Pass through the link below.
please keep posting on Flows & Integrations with different applications.
Introducing Mastering Salesforce Flows Training Course
Liked this post? We are now offering a complete self-paced, video-based training course on Mastering Salesforce Flows. The course comes with downloadable step-by-step PDF guides, unlimited access, free upgrades, community discussion area, free preview and more. For more details, please click here.
Need Help with Flows?
Need advice on Flows? I also offer advisory & consulting services on Salesforce Flows. So, whether you want to create new Flows or migrate existing automations (Workflow Rules, Process Builder, Triggers) to Flows, I can help you analyze, design, plan & review. To initiate a discussion, please submit the contact form here stating your requirement or schedule a discussion at this URL.
References & Useful URLs
- Help Article – Flow Screen Input Component: File Upload (5 mins) – https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_screencmp_fileupload.htm&type=5
Hi Ashish,
Thanks for the wonderful content. But I have a doubt what If the user closes the screen (by clicking on X) after entering the data. Does It create the record without files are being uploaded?
What to do in that case. Is there any possibility to delete those records which are not having files?
And What can we do if we want to place the data and file upload in the same screen? can we upload file to the record created in that case?
Please answer for this. Need ur help, It’ll help me a lot..
Thanks Janu, glad that you liked the content.
1. Yes, if the user closes the screen the record will remain created without the files being uploaded. For such cases, you can write scheduled-triggered flow to run on a nightly basis to delete the records, where there are no files attached.
2. If you notice the properties for file upload screen element, slide 26-29, we have specified the AccountId under ‘Related Record Id’. So, we need to have an Account Record Id before showing this screen to the user as once the user uploads the file, Flow automatically saves it in Salesforce, without us having to use the ‘Create Records’ element. For this reason, we have split the flow into two screens, and we need to do it in two steps.
Hope this clarifies.
This slides ARE great!
TY
You’re welcome, Masud.
for some reason, in the decision element when file is not uploaded, it skips everything else and creates the record. i have set the criteria for no using the fileidlength as youve instructed and made is less than 2. Why is it creating the record when I have other actions after?
Hi Jessica, I tested it again at my end and if I don’t upload the file, it shows me the message “You have not uploaded a file. Uploading file is mandatory. If you don’t want to upload the file, the Account record that you just created won’t be saved. Please check the box below if you don’t want to upload the file.” You may want to check the configuration of your Flow again.
Hi Agrawal,
I need your help for one requirement.
In case object there is one field case origin( with three picklist value). So I want to make attachment mandatory based on two picklist value of case origin. I don’t have a attachment option to attach the file in case creation form.
So I wanted to make attachment mandatory immediate after the case creation.
Hi Abhishek, you won’t be able to do it using the standard screens. I think you will need to use Flows or LWC to create the case where you can enforce this rule.
Hey, the link to the guide is broken. Can you send on a new link please?
Hi Keith, My site was down till yesterday for maintenance. It is back up now. Can you please check if you are still having issues? If yes, please let me know the URL that you are trying to access and I will take a look.
Thank You, spent more than 5 hours to resolve this and finally got this.
Hi Ranjan, do you mean you still needed to spend five hours after referring to this guide? Can you tell me where exactly you struggled so that I can update the guide?
This was great! I had a use case for this and the timing could not have been better. Worked like a charm!
Glad that it helped Adam. 🙂
Thankyou sir, you put lot of efforts in creating those step by step slides in detail.
please keep posting on Flows & Integrations with different applications.
Thank you, Ramesh, for your appreciation. I will try my best to keep such guides coming your way.