function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Stéphane C.Stéphane C. 

Upload Files Directly from a Flow To Opportunity

Hi,

I want to upload files to opportunity. Only one file by opportunity. And I want to display the file on the page.

Is it possible?

I try to make some design but I can't see how I can capture the Opportunity ID.

https://help.salesforce.com/articleView?id=vpm_files.htm&type=0

Is it possible to explain me the inputs and the outpouts setup?

Thank you.
Stéphane C.Stéphane C.
HI,

Any idea for this kind of actions?

Thank you,
Stéphane C.Stéphane C.
Ok. So I want to display a Upload component on an opportunity. When the user upload THE file, a URL file is update to show the image.
But to start I can't see how to pass the Opportunity ID where I want to upload in the flow.

Any idea?
GauravGargGauravGarg
Hi Stephane,
  • Please use Lightning:uploadFile component to upload the file.
  • Assign the recordId variable to upload file on a particular record. 
  • Take "File Name / Names" and display those values in next screen. 

Inflow we cannot display filename in the same screen. 

Hope this helps.

Thanks,

Gaurav
Skype: gaurav62990

Stéphane C.Stéphane C.
Thanks Gaurav,

I give a try with this. And tell you.
Stéphane C.Stéphane C.
How can I assign the recordID? From a new action, is it possible?
GauravGargGauravGarg
Hi Stephane,

Yes we can assign "current recordid" or "current userId" while using forceContent:fileUpload component:
  1. current record: {!$Flow.CurrentRecord}
  2. Current user: {!CurrentUser}

Please try with the above approach once. 

THanks,

Gaurav

Stéphane C.Stéphane C.
Thank you.

I try this but the upload function is not accessible. I can't see why.

User-added image
User-added image

User-added image
GauravGargGauravGarg
Hi Stephane,

Can you try with "current user Id" and check if that works?

Thanks,
Gaurav
Stéphane C.Stéphane C.
I can't use "current user Id". It's very strange.
GauravGargGauravGarg
it would be "{!CurrentUser}"
Stéphane C.Stéphane C.
Not possible to use {!CurrentUser} and I want to access to {!$Flow.CurrentRecord} but I'm not sure that variable is used for this.

Do you use it to create an uploadFile component?
GauravGargGauravGarg
create a formula field of type text with value "{!$User.Id}" name it Current user. 
Stéphane C.Stéphane C.
I can't achieve it. Is it possible to show me an example?
GauravGargGauravGarg
Hi Stephane,

Please go through the below images:

Formula Field - current user

File Upload attributes
You can assign recordId in place of currentUserId, I have tried with userId and its working on my environment. 

Do let me know if you need any help. 

Thanks,
Gaurav
Skype: gaurav62990
Stéphane C.Stéphane C.
Yes, it's working for the user but I can find the way for others objets (standard and custom).
GauravGargGauravGarg
I haven't tried with object's, this would be the same as we are assigning files to Users. Are you facing any error while uploading files to objects?
 
Stéphane C.Stéphane C.
Uploaded function is descativated! Strange.