Why?
In my previous posts, I explained the example of Power Automate: Get Common Data Service Files related to an Entity to Power Automate: Email Common Data Service Files related to an Entity. Now we do not want to email the files, but add the files as attachment to the awesome Modern Approval of Power Automate. 📎
What?
I tried to do the exact same setup as in the above mentioned email post = instead of email the array with attachments just use the array with attachments in the Attachments property of the Start and wait for an approval action but somehow in the Modern Approval the action would fail:
❌“The request failed. Error code: ‘InvalidRequestContent’. Error Message: ‘The request content was invalid and could not be deserialized: ‘Could not find member ‘ContentBytes’ on object of type ‘ApprovalsConnectorAttachment’. Path ‘attachments[0].ContentBytes’, line 1, position 425.’.’.”❌
How?
It appears that the Modern Approval actions do not like the ContentBytes part of the array so I tried replacing it with Content:
{
"Name": @{items('Apply_to_each_NotesOfInvoice')?['filename']},
"Content": @{base64ToBinary(items('Apply_to_each_NotesOfInvoice')?['documentbody'])}
}
resulting in me now having two arrays in my flow:
- varDocumentsArray for the email attachments
- varDocumentsArrayApproval for Modern Approval attachments
I can use the second array in the Attachments property of the Start and wait for an approval action so the attachments show up in my email Inbox being part of the Modern Approval Card:
as well as in my Approval Center being part of the Modern Approval Item:
I was able to get the function to work, but the PDF attachment was ‘corrupt’ and would not open from the email 🙁
Hi Rob, could you verify that you are naming the file including the .pdf extension.
We need to tell the email attachments what type of file it is…
This was extremely helpful, thank you!!
base64 query not working. same error
Is the base64ToBinary function not working anymore in the case of Modern Approval attachment?
Ditd you try the other options in my previous posts?