cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resolver I
Resolver I

Sending a variable number of attachments based on a text field and attachments field content from Power Apps

Hi,

I have a Power App which is essentially a SharePoint custom form for inputting information before it triggers an email to send. The user:

  1. Selects from a Combo box however many attachments they would like to include from a document library (all the same document library, and all pdfs) and
  2. Uploads their own attachments if they wish (currently maximum of 3) using the SharePoint attachments field. Could be any file format, but probably pdfs, docs or jpgs.

Upon form submission, the form submits the doc library selections as a string

Attachment1.pdf, Attachment2.pdf, Attachment3.pdf

To a 'Multiple lines of text' plain text field in a SharePoint list, and also uploads the attachments from Step 2 above to the attachments field in the list.

I have a flow which triggers upon new items being added to this list. I would like to add in actions for it to pull in these two groups of files and attach it all to an email before sending it. There could be no files selected in either step 1 or 2, or some for one step but not the other, or 3 files for each/6 files altogether. I figure this is an array job, but I'm not sure how to write it all out. I can change the separator between the files names with extensions in Step 1, or I can pass through a different field for the files altogether.

Can I please request some help, thanks 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @rhiheu,

 

After you separate the string by using ',' as separator, to get these files store in the SharePoint folder could use the Get file content by using path action, following is steps:

Annotation 2020-07-24 172702.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Community Support
Community Support

Hi @rhiheu,

 

You could use the split() function separate the doc library selections string into an array:

Attachment1.pdf, Attachment2.pdf, Attachment3.pdf

 split('Attachment1.pdf, Attachment2.pdf, Attachment3.pdf', ',')

 

Then use the Get content by using path action to get these file content according to the file name extracted above.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-litu-msft, thanks for your reply. Do you mean I create an array variable?

I've created an 'Initialise variable' action:

AttachmentsArray.jpg

And tried to use an Expression for the initial value:

 

split((triggerOutputs()?['body/SPDocsRequested']),',')

 

To address my 1st attachment type, when the user selects the attachment names from a Combo box and this flows into the 'Multiple lines of text' SP field (which we can call 'SPDocsRequested') but it says:

Expressioninvalid.jpg

Hi @rhiheu,

 

Could you please check the output of the 'Multiple lines of text' SP field? How does it look like?

If it is a string field, it should work correctly.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Who marked this as solved?! Because I didn't. I find it really annoying for (I'm guessing) Microsoft to be intervening here when the original question submitter, me, is still looking for an answer. It's only been a week since the last post so it can hardly be an 'inactive thread' excuse. I'm trying to change it back to unsolved (I've tried marking it as New) but I can't seem to get that to work, so whomever marked it as solved please change it back.

 

Hi @v-litu-msft, apologies for my slow reply. The 'Multiple lines of text' SP field contains a string from the Power App. Upon form submission, the form submits the doc library selections as a string such as:

Attachment1.pdf, Attachment2.pdf, Attachment3.pdf

 

So I'm not sure what to try next? And there is still the question about the step 2 functionality which I'm wondering if someone might know how to address?

 

Thanks.

Hi @rhiheu,

 

After you separate the string by using ',' as separator, to get these files store in the SharePoint folder could use the Get file content by using path action, following is steps:

Annotation 2020-07-24 172702.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Great, thanks @v-litu-msft!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (5,385)