Extract Approval Comments and Store Them in SharePoint via Power Automate
Approval comments come back as an array in Power Automate. This guide shows how to convert them into a clean multi‑line string and save them to a SharePoint list.
When building an approval workflow, you often need to capture the reviewer’s feedback and store it alongside the item that triggered the process. Power Automate returns comments from an approval action inside an array — one entry per response. This format is useful for driving conditional logic but isn’t directly readable in a SharePoint list column. By converting that array into a multi‑line text field, you create a permanent, human‑friendly record of every approval comment.
An Example Scenario: Purchase Order Approvals
Imagine a procurement department that uses a SharePoint list to track incoming purchase orders. Each new item must be approved by a manager, who can optionally leave a comment. After the approval completes, the system should write the manager’s feedback back to the same SharePoint item. The list is named PO Approvals and includes these columns:
- Title – Single line of text (auto‑generated from the purchase order ID).
- ApprovalDecision – Choice field (Approved / Rejected).
- ApprovalNotes – Multiple lines of text (plain text).
The goal is to populate ApprovalNotes with the comments received during the approval, with each distinct comment on its own line.
Building the Flow
Open Power Automate and create an Automated cloud flow that triggers when a new item is added to the PO Approvals list.
1. Trigger and Approval Action
After the trigger, add the standard Start and wait for an approval action. Configure it to send an approval to the appropriate person or group, and be sure to enable the Comments input so responders can leave feedback.
When the approval finishes (approved or rejected), the action’s outputs include an array called responses. Each response object contains the comment property.
2. Compose the Comments Array
To make the array easier to work with, insert a Compose action. In its Inputs field, use the dynamic content selector to pick Responses Comments from the approval action. This step stores the full array of comment strings.
3. Convert the Array to Multi‑Line Text
Now you need to join the individual comment strings into a single block of text, with line breaks separating each comment. The join function combined with decodeUriComponent('%0A') (where %0A is the URL‑encoded line feed character) accomplishes this.
Add a Update item action (from the SharePoint connector) that targets the current item in the PO Approvals list. Map the dynamic Title and set ApprovalDecision to outputs('Start_and_wait_for_an_approval')?['outcome']. For the ApprovalNotes field, use the following expression:
join(outputs('Compose_Comments'), decodeUriComponent('%0A'))If you have multiple levels of approvals or need to ensure only comments from the final response are captured, you can filter the array before joining. For most single‑stage approvals, the above expression is sufficient.
When no comment is left, the array will contain empty strings. The join expression will still produce blank lines. To avoid that, wrap the join in a trim() expression – but remember that you might want to preserve the order of responses even if some are empty.
4. Test the Flow
Save the flow and create a new item in the PO Approvals list. The flow will trigger, send an approval request (for example, via the Power Automate mobile app or Teams), and wait for a response. When the manager approves or rejects with a comment, the flow continues and writes the comments back to the ApprovalNotes column.
Verify that the comments appear exactly as entered, each on a new line. If the flow runs successfully but the column remains empty, double‑check that your expression references the correct Compose action name.
Security, Performance, and Best Practices
- Consent and permissions: The SharePoint connection used in the flow must have write access to the target list. The approval action itself requires that the approver can participate in the approval (which is handled by the built‑in approval connector).
- Multiple approvers: If your approval requires responses from several people (e.g., “All must approve”), the responses array will contain an entry for each person. The join expression shown above will combine all of them – consider ordering them by time or adding the responder’s name for clarity.
- Avoid excessive Apply to each loops: The solution shown here uses a single Compose + Update action, eliminating the need for an explicit loop. This is both faster and easier to maintain.
- Delegation: When working with SharePoint lists, the Update item action can modify only one item at a time. That’s fine here because we are updating the same item that triggered the flow. No delegation concerns apply.
Common Mistakes and Troubleshooting
| Mistake | Symptom | Fix |
|---|---|---|
| Using the wrong dynamic content for comments | The Compose output is null or contains {} | Ensure you pick Responses Comments from the Start and wait for an approval action, not from the trigger or other steps. |
| Forgetting to URL‑encode the line feed | Comments appear as a single run‑on line | Use decodeUriComponent('%0A') exactly as shown, or use %0D%0A for Windows‑style line breaks. |
| Trying to store an array directly in a text column | Flow fails with a type mismatch | The join expression converts the array to a string – without it, the column cannot accept the data. |
| Running into length limits | Truncated comments | SharePoint’s multi‑line text field can hold up to 63,999 characters; for very long feedback, consider storing comments in a separate document or using a note column. |
Final Recommendation
The technique of joining an approval‑comments array with decodeUriComponent('%0A') is lightweight, works for both single and multi‑responder scenarios, and integrates seamlessly with SharePoint. Keep the flow simple: one trigger, one approval, one compose, and one update. Avoid unnecessary looping steps, and always test with at least two different comment values to verify the line‑break behavior.
References
- Original article: How To Get Approval Comments In Power Automate by Matthew Devaney
- Microsoft Learn: Start and wait for an approval action
- Microsoft Learn: Join function in Power Automate
Core principles for resilient, maintainable, and efficient cloud flows, distilled from real-world implementations.
Build flows that gracefully handle failures and automatically notify you with run details.
Discover the trade-offs between Content-ID, Base64, and the Microsoft Graph API for embedding images in Power Automate emails. This guide covers which method works best for Outlook, Gmail, and more.