Hi, I am new to Power Automate and I was given this project to debug but previous it just shown infinite loop when sending a message but I able to solve that problem (I hope). Recently, one of the employees approved a document to replace the old one and the error shown as below.
Explaination for the flow:
- The flow starts with a trigger that gets the updated items from a SharePoint list. Then, it retrieves items from the same SharePoint list based on specific conditions.
- Next, it initializes some variables and an array to store attachments.
- Inside a loop, it gets the attachments for each item and stores them in the array. If the document type is "Procedure", it creates a file in a specific folder and updates its properties. Otherwise, it creates a file in a different folder and updates its properties.
- After that, it retrieves the process and document type for each item. If the document type is "Procedure" and there are existing items in another SharePoint list with the same process, it deletes the attachments, adds the new attachment, and updates the item properties. If there are no existing items, it creates a new item and adds the attachment.
- If the document type is "Policy", it follows a similar process as above but with a different SharePoint list.
- If the document type is "Guideline", it follows a similar process as above but with another SharePoint list.
- If the document type is neither "Procedure", "Policy", nor "Guideline", it sends a message to a Microsoft Teams channel.
- Finally, it updates the items in the SharePoint list and sends a message to the Microsoft Teams channel.
My problem is also similar to this thread: BadRequest in Power Automate while the attachment is uploaded to Sharepoint
Thank you!

