So I'm putting together a Power Automate Flow that takes in the emails synced to a queue and depending on the direction of the email will change the case status to Pending (pending a response from a customer) or Require Attention.
The logic is basically if a new email comes in (e.g. the Direction is Incoming and Status Reason is Received) it will change the status reason of the case to a new option called "Require Attention". In the same logic if the email's direction is outgoing and status reason is Sent then it will change the regarding case's status reason to Pending (as in it's pending a response from the customer).
This works very well when composing and sending emails from Dynamics and via the case timeline. The problem arises when a user might want to sent a reply to the customer via the queue inbox in Outlook. It tracks the email automatically back to the case in Dynamics but for some reason the status reason is Received and the email direction is incoming even though it's an outgoing email but just sent from Outlook as opposed to via Dynamics (one of the most important reasons for this is that Dynamics emails doesn't allow for copying images from your desktop and displaying them contextually in the body of the email).
I've basically then had to add a extra check after the initial check to see if the sender type of the email is set to "queues" and if yes still set the case status to pending.
Is there a better way to handle this?