The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body']?['attachments']' is of type 'Null'. The result must be a valid array.
If TRUE → proceed with Apply to each using body('trigger')?['attachments']
If FALSE → skip sending cards or handle alternative path
This ensures your loop only runs when there's actually an array.
Option 2: Use coalesce() to ensure an array
If you prefer a one-liner inside Apply to each:
coalesce(triggerOutputs()?['body']?['attachments'], createArray())
That ensures Power Automate always receives an array—even when attachments is null.
If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
Regards,
Riyaz
Was this reply helpful?YesNo
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.