Flow approval attachments

Scenario 1:

I have a document library, User will upload the document to the document library, then it will trigger the MS flow, for approval.

Here the document has to be added as attachment for approval.

How to do,

Step: In PA, Instant flow

Step: "For selected file"

Start and wait for approval:

Approval type: Approve/Reject-First to respond

Title: Invoice approval for <FileName>

Assigned To: Koti

Attachments Name-1

Select <fileName>

Attachment Content-1:

In order to get attachment content,

Before- Add action name "Get file properties" and Select Site Address, Library Name, Id. This will give all the properties of the file.

Next, we need to add "Get file content" action. Pick site address and file identifier: Select Identifier. This will give actual content of the file in base 64 formate.

Now in "Start and wait for approval" action, attachment content-1: choose "File Content"

Step: Condition: Outcome is equal to Approve

Step: If Yes, Compose action: Approved

If No, Rejected

Click Save the flow as named: Invoice Approval.

Using the flow: Now go and upload the file in document library.

Select the power automate icon in ribbon and click on the Invoice Approval and click run.

Now the flow running status history.

now check email, email received with attachment.

now approver, In email can do action approve or reject.

-----------------

Scenario 2: 

Now SharePoint List. How to create a dynamic array in SharePoint List.

Means, For example in "Start and wait for approval" action, I have attachment section as Attachment Name-1 and Attachment Content-1.
In case i have multiple files, then we need to make it dynamic array.

Step: Instant Flow
Step: When an item is created
Step: "Get attachments" action, select stie, list and Id. This gives all the attachments in SP List.
Step: "Get attachment content" action,
Site Address,List, Id,  File identifier: Choose from Get attachments action output ->Id

Automatically apply to each, beacuse it returns multiple attachments.

Step: Now we need to create a variable in above steps for creating array.

Add Initialize varaible: varAttachments of type Array.

In Apply to each action, add "Append to array variable" action.

Name: varAttachments

Value: frame the array as below with syntax.(JSON object)

[

 "name":<DispalyName from get attachments>,

 "content":<Attachment Content from get attachments>

]

add new step out side apply to each

Add "Start and wait for Approval"

Approval type: Approve/Reject- First to respond

Title: workflow task <Title>

Assigned To: Koti

Attachments Name-1 on right side T symbol represents switch action.

Attachements: This list of attachments. Now add from variable we created called" varAttachments"

Add Condition, Outcome is equal to Approve

if Yes, Compose Approved

if No, Compose action Rejected

Usage: Now go the list and add an item in SP list. the flow triggers.

In the form while filling, add multiple attachments as pdf, jpg, word file etc.. the click save.

Now in flow running action history chek.

In email, you see 3 attachments with approval/.reject button response.

---------------------------------

Scenario 3:

Microsoft Forms.

In Microsoft forms, files will be saved in onedrive.
------------------------------------------------------

Instant flow, 

"When a new response is submitted."

"Get response detail" action choose form id and reponse id from response action 

Save the form.

---------------------

Limitations

CDS, max file size limit is 5MB, it can be changed by admin.
Approval connector attachment size limits to 50MB, and this limit cannot be changed.
Approval email attachment max size is 5MB. if it more than then message appears in email as "This email contains attachments for approval are too big". So approver cannot see those attachments.



Comments